Public Member Functions | |
| __construct ($folder='', $lang='en', $domain='pluf') | |
| loadDomain ($lang='en', $domain='pluf') | |
| loadFile ($file) | |
| optimizeLocale ($file) | |
| getAvailableLocales ($domain='') | |
| getAcceptedLanguage ($available, $accepted='') | |
| getIsoCodes ($lang=false) | |
Static Public Member Functions | |
| static | getCountryCodes ($idx_by_code=false) |
| static | getNativeLanguages ($lang=false) |
| static | getInstalledLanguages () |
Public Attributes | |
| $locale_folder = '' | |
The localization of the code is performed using the __() function call. This function is directly available in the Pluf.php file.
The Pluf_L10n class is used to load the localization strings in memory in the $GLOBALS['_PX_locale'] array. All the strings are stored in utf-8 as all the applications created with the Plume Framework must use the utf-8 encoding. The Pluf locale files are in the Pluf/locale/ folder.
The locale files can be optimized and an optimized version of the files stored in the Pluf temp folder. The temp folder is defined in the global configuration as 'tmp_folder'.
2 letter ISO codes from http://www.oasis-open.org/cover/iso639a.html
| Pluf_L10n::__construct | ( | $ | folder = '', |
|
| $ | lang = 'en', |
|||
| $ | domain = 'pluf' | |||
| ) |
Constructor.
See loadDomain(). If no folder is provided, the default Pluf/locale folder is used to load the locales from.
| string | Locale folder without trailing slash ('') | |
| string | Language ('en') | |
| string | Domain ('pluf') |
| Pluf_L10n::loadDomain | ( | $ | lang = 'en', |
|
| $ | domain = 'pluf' | |||
| ) |
Load a domain file. A domain file is a .lang file in the main locale folder of plume.
| string | Language ('en') | |
| string | Domain, without the .lang ('pluf') |
| Pluf_L10n::loadFile | ( | $ | file | ) |
Load a locale file
| string | Complete path to the locale file |
| Pluf_L10n::optimizeLocale | ( | $ | file | ) |
Optimize a locale. Convert the .lang in a .php file ready to be included. The optimized file is encoded with the current encoding.
| string | Locale file to optimize |
| Pluf_L10n::getAvailableLocales | ( | $ | domain = '' |
) |
Get the available locales for a domain.
| string | Domain ('') |
| Pluf_L10n::getAcceptedLanguage | ( | $ | available, | |
| $ | accepted = '' | |||
| ) |
Return the "best" accepted language from the list of available languages.
Use $_SERVER['HTTP_ACCEPT_LANGUAGE'] if the accepted language is empty
| array | Available languages in the system | |
| string | String of comma separated accepted languages ('') |
| Pluf_L10n::getIsoCodes | ( | $ | lang = false |
) |
Returns iso codes.
| bool | Is the language the key in the array (false) |
| static Pluf_L10n::getCountryCodes | ( | $ | idx_by_code = false |
) | [static] |
Get the country codes.
| Indexed | by code (false) |
| static Pluf_L10n::getNativeLanguages | ( | $ | lang = false |
) | [static] |
Returns iso codes.
| bool | Is the language the key in the array (false) |
| static Pluf_L10n::getInstalledLanguages | ( | ) | [static] |
| Pluf_L10n::$locale_folder = '' |
Folder in which the locale file are available.