14 if (!function_exists(
'gettext')) {
15 throw new \RuntimeException(
'This class require the gettext extension for PHP');
21 $language = getenv(
'LANGUAGE') ?: getenv(
'LC_ALL') ?: getenv(
'LC_MESSAGES') ?: getenv(
'LANG');
39 if ($category === null) {
40 $category = defined(
'LC_MESSAGES') ? LC_MESSAGES : LC_ALL;
61 bind_textdomain_codeset(
$domain,
'UTF-8');
77 return gettext($original);
85 public function ngettext($original, $plural, $value)
87 return ngettext($original, $plural, $value);
97 return dngettext(
$domain, $original, $plural, $value);
108 $translation = ngettext(
$message, $plural, $value);
110 return ($translation ===
$message) ? $original : $translation;
123 return ($translation ===
$message) ? $original : $translation;
133 return dgettext(
$domain, $original);
146 return ($translation ===
$message) ? $original : $translation;
159 return ($translation ===
$message) ? $original : $translation;
Interface used by all translators.
ngettext($original, $plural, $value)
dnpgettext($domain, $context, $original, $plural, $value)
loadDomain($domain, $path=null, $default=true)
Loads a gettext domain.
dngettext($domain, $original, $plural, $value)
catch(Exception $e) $message
dpgettext($domain, $context, $original)
dgettext($domain, $original)
pgettext($context, $original)
__construct($language=null)
Constructor.
npgettext($context, $original, $plural, $value)
setLanguage($language, $category=null)
Define the current locale.
if(!array_key_exists('domain', $_REQUEST)) $domain