Class Ice

I18n

Internationalization (i18n) class.
Methods
__construct(array $options)
I18n constructor.
fetch()
Return the last I18n created.
string
lang(string $lang)
Get and set the target language.
string
iso(variable $lang, bool $country)
Get ISO language code.
string
get(string $str, variable $form, string $lang)
Returns specified form of a string translation. No parameters are replaced.
array
load(string $lang)
Load language from the file.
plural(string $str, int $count, string $lang)
Returns translation of a string with right plural form.
pluralRules(string $code)
Plural rules lazy initialization.
string
_(string $str, array $values, variable $context, string $lang)
Alias of translate.
string
translate(string $str, array $values, variable $context, string $lang)
Translation/internationalization function. strtr() or sprintf is used for replacing parameters.
Methods Details
  • public function __construct(array $options)

    I18n constructor.
  • public static function fetch()

    Return the last I18n created.
  • public function lang(string $lang)

    Get and set the target language.
  • public function iso(variable $lang, bool $country)

    Get ISO language code.
  • public function get(string $str, variable $form, string $lang)

    Returns specified form of a string translation. No parameters are replaced.
    If no translation exists, the original string will be returned.
  • private function load(string $lang)

    Load language from the file.
  • public function plural(string $str, int $count, string $lang)

    Returns translation of a string with right plural form.
    If no translation exists, the original string will be returned.
  • protected function pluralRules(string $code)

    Plural rules lazy initialization.
  • public function _(string $str, array $values, variable $context, string $lang)

    Alias of translate.
  • public function translate(string $str, array $values, variable $context, string $lang)

    Translation/internationalization function. strtr() or sprintf is used for replacing parameters.
  • internal function zephir_init_properties_Ice_I18n()