Class Locale

Description

Habari Locale Class

Provides translation services.

Located in /system/classes/locale.php (line 10)


	
			
Method Summary
static array. list_all ()
static boolean load_pluggable_domain (string $domain, string $base_dir)
static void set ([string $locale = NULL])
static string set_system_locale (string... $locale)
static void _e (string $text, string $domain)
static string _n (string $singular, string $plural, string $count, [string $domain = 'habari'])
static void _ne (string $singular, string $plural, string $count, [string $domain = 'habari'])
static string _t (string $text, [ $args = array()], [string $domain = 'habari'])
static void __run_loadfile_test ( $filename)
static void __run_plural_test ( $header)
Methods
static method list_all (line 104)

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

  • return: An array of Habari locales in the installation
  • access: public
static array. list_all ()
static method load_pluggable_domain (line 63)

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.

static boolean load_pluggable_domain (string $domain, string $base_dir)
  • string $domain: the domain to load
  • string $base_dir: the base directory in which to find the translation files
static method set (line 22)

Sets the locale for Habari.

  • access: public
static void set ([string $locale = NULL])
  • string $locale: A language code like 'en' or 'en-us' or 'x-klingon', will be lowercased
static method set_system_locale (line 44)

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@euro' (Linux) or 'DEU' (Windows), etc.

  • return: the locale that was picked, or FALSE if an error occurred
  • access: public
static string set_system_locale (string... $locale)
  • string... $locale: The locale(s) to set. They will be tried in order.
static method _e (line 283)

Echo a version of the string translated into the current locale

  • access: public
static void _e (string $text, string $domain)
  • string $text: The text to echo translated
  • string $domain: (optional) The domain to search for the message
static method _n (line 339)

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

  • return: The appropriately translated string
  • access: public
static string _n (string $singular, string $plural, string $count, [string $domain = 'habari'])
  • string $singular: The singular form
  • string $plural: The plural form
  • string $count: The count
  • string $domain: (optional) The domain to search for the message
static method _ne (line 325)

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

  • access: public
static void _ne (string $singular, string $plural, string $count, [string $domain = 'habari'])
  • string $singular: The singular form
  • string $plural: The plural form
  • string $count: The count
  • string $domain: (optional) The domain to search for the message
static method _t (line 296)

Return a version of the string translated into the current locale

  • return: The translated string
  • access: public
static string _t (string $text, [ $args = array()], [string $domain = 'habari'])
  • string $text: The text to echo translated
  • string $domain: (optional) The domain to search for the message
  • $args
static method __run_loadfile_test (line 273)

DO NOT USE THIS FUNCTION.

This function is only to be used by the test case for the Locale class!

  • access: public
static void __run_loadfile_test ( $filename)
  • $filename
static method __run_plural_test (line 258)

DO NOT USE THIS FUNCTION.

This function is only to be used by the test case for the Locale class!

  • access: public
static void __run_plural_test ( $header)
  • $header

Documentation generated on Thu, 30 Oct 2008 20:31:20 +0100 by phpDocumentor 1.3.2