Static Public Member Functions

HabariLocale Class Reference

List of all members.

Static Public Member Functions

static set ($locale=null)
static set_system_locale ()
static load_pluggable_domain ($domain, $base_dir)
static list_all ()
static __run_plural_test ($header)
static __run_loadfile_test ($filename)
static _e ()
static _t ($text, $args=array(), $domain= 'habari')
static _u ($text, $domain= 'habari')
static _ne ($singular, $plural, $count, $domain= 'habari')
static _n ($singular, $plural, $count, $domain= 'habari')

Detailed Description

Habari Locale Class

Provides translation services.

Definition at line 13 of file habarilocale.php.


Member Function Documentation

static HabariLocale::__run_loadfile_test ( filename  )  [static]

DO NOT USE THIS FUNCTION. This function is only to be used by the test case for the Locale class!

Definition at line 277 of file habarilocale.php.

static HabariLocale::__run_plural_test ( header  )  [static]

DO NOT USE THIS FUNCTION. This function is only to be used by the test case for the Locale class!

Definition at line 262 of file habarilocale.php.

static HabariLocale::_e (  )  [static]

Echo a version of the string translated into the current locale

Parameters:
string $text The text to echo translated
string $domain (optional) The domain to search for the message

Definition at line 287 of file habarilocale.php.

static HabariLocale::_n ( singular,
plural,
count,
domain = 'habari' 
) [static]

Return a singular or plural string translated into the current locale based on the count provided

Parameters:
string $singular The singular form
string $plural The plural form
string $count The count
string $domain (optional) The domain to search for the message
Returns:
string The appropriately translated string

Definition at line 362 of file habarilocale.php.

Referenced by _ne().

static HabariLocale::_ne ( singular,
plural,
count,
domain = 'habari' 
) [static]

Echo singular or plural version of the string, translated into the current locale, based on the count provided

Parameters:
string $singular The singular form
string $plural The plural form
string $count The count
string $domain (optional) The domain to search for the message

Definition at line 348 of file habarilocale.php.

static HabariLocale::_t ( text,
args = array(),
domain = 'habari' 
) [static]

Return a version of the string translated into the current locale

Parameters:
string $text The text to echo translated
string $domain (optional) The domain to search for the message
Returns:
string The translated string

Definition at line 300 of file habarilocale.php.

static HabariLocale::_u ( text,
domain = 'habari' 
) [static]

Given a string translated into the current locale, return the untranslated string.

Parameters:
string $text The translated string
string $domain (optional) The domain to search for the message
Returns:
string The untranslated string

Definition at line 328 of file habarilocale.php.

static HabariLocale::list_all (  )  [static]

function list_all Retrieves an array of the Habari locales that are installed

Returns:
array. An array of Habari locales in the installation

Definition at line 107 of file habarilocale.php.

Referenced by InstallHandler::act_begin_install(), and AdminOptionsHandler::post_options().

static HabariLocale::load_pluggable_domain ( domain,
base_dir 
) [static]

Load translations for a given domain and base directory for a pluggable object. Translations are stored in gettext-style .mo files. The internal workings of the file format are not entirely meant to be understood.

GNU Gettext Manual: Description of the MO file format string $domain the domain to load string $base_dir the base directory in which to find the translation files boolean true if data was successfully loaded, false otherwise

Definition at line 66 of file habarilocale.php.

Referenced by Pluggable::load_text_domain().

static HabariLocale::set ( locale = null  )  [static]

Sets the locale for Habari.

Parameters:
string $locale A language code like 'en' or 'en-us' or 'x-klingon', will be lowercased

Definition at line 25 of file habarilocale.php.

Referenced by InstallHandler::act_begin_install().

static HabariLocale::set_system_locale (  )  [static]

Set system locale.

The problem is that every platform has its own way to designate a locale, so for German you could have 'de', 'de_DE', 'de_DE.UTF-8', 'de_DE.UTF-8' (Linux) or 'DEU' (Windows), etc.

Todo:
: This setting should probably be stored in the language files.
Parameters:
string... $locale The locale(s) to set. They will be tried in order.
Returns:
string the locale that was picked, or false if an error occurred

Definition at line 47 of file habarilocale.php.


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