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 |
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: |
|
locale_charset [line 315]
void locale_charset(
[ $disp = true]
)
|
|
Returns the charset of the current locale
Parameters:
locale_country [line 368]
string locale_country(
[string $locale = '']
)
|
|
Get the country locale
Parameters:
|
string |
$locale: |
locale to use, '' for current |
API Tags:
locale_datefmt [line 329]
Returns the current locale's default date format
locale_dialing_code [line 381]
void locale_dialing_code(
[ $locale = '']
)
|
|
Get the locale country dialing code
Parameters:
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 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 |
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 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? |
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 |
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 |
locale_priosort [line 563]
void locale_priosort(
$a, $b
)
|
|
user sort function to sort locales by priority
- is highest priority.
Parameters:
locale_restore_previous [line 202]
boolean locale_restore_previous(
)
|
|
Restore the locale in use before the switch
API Tags:
locale_startofweek [line 353]
integer locale_startofweek(
)
|
|
Returns the current locale's start of week
API Tags:
| Return: | 0 for Sunday, 1 for Monday |
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 |
locale_timefmt [line 340]
Returns the current locale's default time format
locale_updateDB [line 659]
Write $locales array to DB table
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:
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: