b2evolution

Multilingual multiuser multiblog engine

b2evolution Technical Documentation (Version 1.8) [ class tree: evocore ] [ index: evocore ] [ all elements ]

Procedural File: _locale.funcs.php

Source Location: /blogs/inc/MODEL/settings/_locale.funcs.php

Page Details

This file implements functions for handling locales and i18n.

This file implements functions for logging of hits and extracting stats.

This file is part of the evoCore framework - http://evocore.net/ See also http://sourceforge.net/projects/evocms/.

Author:  fplanque: Francois PLANQUE.
Author:  blueyed: Daniel HAHLER.
Version:  $Id: _locale.funcs.php,v 1.7.2.5 2006/12/02 02:41:27 fplanque Exp $
Copyright:  

(c)2003-2006 by Francois PLANQUE - http://fplanque.net/ Parts of this file are copyright (c)2004-2006 by Daniel HAHLER - http://thequod.de/contact.

Todo:  Make it a class / global object!
  • Provide (static) functions to extract .po files / generate _global.php files (single quoted strings!)
Filesource:  Source Code for this file
Functions
locale_activate  [line 221]

void locale_activate( string $locale, mixed 1  )

returns true if locale has been changed

Parameters:
mixed   1:  locale string on success, false on failure
string   $locale:  locale to activate


[ Top ]
locale_by_lang  [line 275]

void locale_by_lang( $lang, [ $fallback_to_default = true]  )

locale_by_lang(-)

Find first locale matching lang

Parameters:
   $lang: 
   $fallback_to_default: 


[ Top ]
locale_charset  [line 315]

void locale_charset( [ $disp = true]  )

Returns the charset of the current locale

Parameters:
   $disp: 


[ Top ]
locale_country  [line 368]

string locale_country( [string $locale = '']  )

Get the country locale

Parameters:
string   $locale:  locale to use, '' for current

API Tags:
Return:  country locale


[ Top ]
locale_datefmt  [line 329]

void locale_datefmt( )

Returns the current locale's default date format



[ Top ]
locale_dialing_code  [line 381]

void locale_dialing_code( [ $locale = '']  )

Get the locale country dialing code

Parameters:
   $locale: 


[ Top ]
locale_flag  [line 406]

void locale_flag( [string $locale = ''], [string $collection = 'w16px'], [string $class = 'flag'], [string $align = ''], [boolean $disp = true], [mixed $absoluteurl = true]  )

Template function: Display locale flag

Parameters:
string   $locale:  locale to use, '' for current
string   $collection:  collection name (subdir of img/flags)
string   $class:  name of class for IMG tag
string   $align:  deprecated HTML align attribute
boolean   $disp:  to echo or not
mixed   $absoluteurl:  use absolute url (===true) or path to flags directory


[ Top ]
locale_from_httpaccept  [line 501]

locale locale_from_httpaccept( )

Detect language from HTTP_ACCEPT_LANGUAGE

First matched full locale code in HTTP_ACCEPT_LANGUAGE will win Otherwise, first locale in table matching a lang code will win


API Tags:
Return:  made out of HTTP_ACCEPT_LANGUAGE or $default_locale, if no match


[ Top ]
locale_lang  [line 301]

string locale_lang( [boolean $disp = true]  )

Displays/Returns the current locale. (for backward compatibility)

Parameters:
boolean   $disp:  true (default) if we want it to be outputted

API Tags:
Return:  current locale, if $disp = false


[ Top ]
locale_options  [line 450]

void locale_options( [string $default = ''], [boolean $disp = true]  )

[callback function] Outputs an <option> set with default locale selected

Parameters:
string   $default:  default value
boolean   $disp:  echo output?


[ Top ]
locale_options_return  [line 486]

void locale_options_return( [string $default = '']  )

[callback function] Returns an <option> set with default locale selected

Parameters:
string   $default:  default value


[ Top ]
locale_overwritefromDB  [line 574]

mixed locale_overwritefromDB( )

load locales from DB into $locales array. Also sets $default_locale.


API Tags:
Return:  new default locale on succes, false on failure


[ Top ]
locale_priosort  [line 563]

void locale_priosort( $a, $b  )

user sort function to sort locales by priority

  1. is highest priority.

Parameters:
   $a: 
   $b: 


[ Top ]
locale_restore_previous  [line 202]

boolean locale_restore_previous( )

Restore the locale in use before the switch


API Tags:
Return:  true on success, false on failure (no locale stored before)
See:  locale_temp_switch()


[ Top ]
locale_startofweek  [line 353]

integer locale_startofweek( )

Returns the current locale's start of week


API Tags:
Return:  0 for Sunday, 1 for Monday


[ Top ]
locale_temp_switch  [line 183]

void locale_temp_switch( string $locale  )

Temporarily switch to another locale

Calls can be nested, see locale_restore_previous().

Parameters:
string   $locale:  locale to activate


[ Top ]
locale_timefmt  [line 340]

void locale_timefmt( )

Returns the current locale's default time format



[ Top ]
locale_updateDB  [line 659]

void locale_updateDB( )

Write $locales array to DB table



[ Top ]
TS_  [line 170]

string TS_( string $string, [string $req_locale = '']  )

Translate and escape single quotes.

This is to be used mainly for Javascript stings.

Parameters:
string   $string:  String to translate
string   $req_locale:  Locale to use

API Tags:
Uses:  T_()


[ Top ]
T_  [line 53]

void T_( string $string, [string $req_locale = '']  )

TRANSLATE!

Translate a text to the desired locale (b2evo localization only) or to the current locale

Parameters:
string   $string:  String to translate, '' to get language file info (as in gettext spec)
string   $req_locale:  locale to translate to, '' to use current locale (basic gettext does only support '')

API Tags:
Usedby:  TS_()


[ Top ]


Documentation generated on Tue, 18 Dec 2007 23:18:29 +0100 by phpDocumentor 1.4.0