Pluf_L10n Class Reference

List of all members.

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 = ''


Detailed Description

Localization class.

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


Constructor & Destructor Documentation

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.

Parameters:
string Locale folder without trailing slash ('')
string Language ('en')
string Domain ('pluf')


Member Function Documentation

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.

Parameters:
string Language ('en')
string Domain, without the .lang ('pluf')
Returns:
bool Success

Pluf_L10n::loadFile ( file  ) 

Load a locale file

Parameters:
string Complete path to the locale file
Returns:
bool Success

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.

Parameters:
string Locale file to optimize
Returns:
bool Success

Pluf_L10n::getAvailableLocales ( domain = ''  ) 

Get the available locales for a domain.

Parameters:
string Domain ('')
Returns:
array List of 2 letter iso codes

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

Parameters:
array Available languages in the system
string String of comma separated accepted languages ('')
Returns:
string Language 2 letter iso code, default is 'en'

Pluf_L10n::getIsoCodes ( lang = false  ) 

Returns iso codes.

Parameters:
bool Is the language the key in the array (false)
Returns:
array The key is either the language or the iso code

static Pluf_L10n::getCountryCodes ( idx_by_code = false  )  [static]

Get the country codes.

Parameters:
Indexed by code (false)
Returns:
array English name indexed country code or reverse

static Pluf_L10n::getNativeLanguages ( lang = false  )  [static]

Returns iso codes.

Parameters:
bool Is the language the key in the array (false)
Returns:
array The key is either the language or the iso code

static Pluf_L10n::getInstalledLanguages (  )  [static]


Member Data Documentation

Pluf_L10n::$locale_folder = ''

Folder in which the locale file are available.


The documentation for this class was generated from the following file:

Generated on Wed Feb 3 15:44:52 2010 for Pluf by  doxygen