Procedural File: _functions_locale.php
Source Location: /blogs/b2evocore/_functions_locale.php
Functions
locale_activate [line 151]
void locale_activate(
string $locale
)
|
|
locale_activate(-)
returns true if locale has been changed
Parameters:
|
string |
$locale: |
locale to activate |
locale_by_lang [line 203]
void locale_by_lang(
$lang, [ $fallback_to_default = true]
)
|
|
locale_by_lang(-)
Find first locale matching lang
Parameters:
|
|
$lang: |
|
|
|
$fallback_to_default: |
|
locale_charset [line 247]
void locale_charset(
[ $disp = true]
)
|
|
Returns the charset of the current locale
Parameters:
locale_datefmt [line 263]
Returns the current locale's default date format
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 |
locale_from_httpaccept [line 370]
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 |
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 |
locale_options [line 342]
void locale_options(
[ $default = '']
)
|
|
Parameters:
locale_overwritefromDB [line 442]
void locale_overwritefromDB(
)
|
|
load locales from DB into $locales array. Also sets $default_locale.
locale_priosort [line 432]
void locale_priosort(
$a, $b
)
|
|
user sort function to sort locales by priority
- is highest priority.
Parameters:
locale_restore_previous [line 136]
void locale_restore_previous(
)
|
|
Restore the locale in use before the switch
locale_temp_switch [line 122]
void locale_temp_switch(
string $locale
)
|
|
Temporarily switch to another locale
Calls can be nested.
Parameters:
|
string |
$locale: |
locale to activate |
locale_timefmt [line 276]
Returns the current locale's default time format
locale_updateDB [line 526]
write $locales array to DB table
Information Tags:
NT_(-)
No Translation Nevertheless, the string will be extracted by the gettext tools
Parameters:
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 '') |