The branch, master has been updated
via 8a8986d9da55d2ef7951f7fcb59ec7a01f9a8b63 (commit)
from 62e17e3193e483dc0f4d90c0cb22cafd95068359 (commit)
- Log -----------------------------------------------------------------
commit 8a8986d9da55d2ef7951f7fcb59ec7a01f9a8b63
Author: Michal Čihař <michal(a)cihar.com>
Date: Mon Dec 27 14:20:35 2010 +0100
Update php-gettext to 1.0.11.
There are two changes:
- fix possible wrong result of npgettext
- cosmetical renaming of some variables
-----------------------------------------------------------------------
Summary of changes:
libraries/php-gettext/gettext.inc | 78 +++++++++++++++++++------------------
libraries/php-gettext/gettext.php | 10 ++++-
2 files changed, 48 insertions(+), 40 deletions(-)
mode change 100644 => 100755 libraries/php-gettext/gettext.php
diff --git a/libraries/php-gettext/gettext.inc b/libraries/php-gettext/gettext.inc
index 399a0f2..00b9666 100644
--- a/libraries/php-gettext/gettext.inc
+++ b/libraries/php-gettext/gettext.inc
@@ -32,7 +32,6 @@ LC_MESSAGES 5
LC_ALL 6
*/
-
// LC_MESSAGES is not available if php-gettext is not loaded
// while the other constants are already available from session extension.
if (!defined('LC_MESSAGES')) {
@@ -229,7 +228,9 @@ function _setlocale($category, $locale) {
}
// Allow locale to be changed on the go for one translation domain.
global $text_domains, $default_domain;
- unset($text_domains[$default_domain]->l10n);
+ if (array_key_exists($default_domain, $text_domains)) {
+ unset($text_domains[$default_domain]->l10n);
+ }
return $CURRENTLOCALE;
}
}
@@ -288,9 +289,9 @@ function __($msgid) {
/**
* Plural version of gettext.
*/
-function _ngettext($single, $plural, $number) {
+function _ngettext($singular, $plural, $number) {
$l10n = _get_reader();
- return _encode($l10n->ngettext($single, $plural, $number));
+ return _encode($l10n->ngettext($singular, $plural, $number));
}
/**
@@ -304,9 +305,9 @@ function _dgettext($domain, $msgid) {
/**
* Plural version of dgettext.
*/
-function _dngettext($domain, $single, $plural, $number) {
+function _dngettext($domain, $singular, $plural, $number) {
$l10n = _get_reader($domain);
- return _encode($l10n->ngettext($single, $plural, $number));
+ return _encode($l10n->ngettext($singular, $plural, $number));
}
/**
@@ -319,9 +320,9 @@ function _dcgettext($domain, $msgid, $category) {
/**
* Plural version of dcgettext.
*/
-function _dcngettext($domain, $single, $plural, $number, $category) {
+function _dcngettext($domain, $singular, $plural, $number, $category) {
$l10n = _get_reader($domain, $category);
- return _encode($l10n->ngettext($single, $plural, $number));
+ return _encode($l10n->ngettext($singular, $plural, $number));
}
/**
@@ -405,29 +406,29 @@ function T_($msgid) {
if (_check_locale_and_function()) return _($msgid);
return __($msgid);
}
-function T_ngettext($single, $plural, $number) {
+function T_ngettext($singular, $plural, $number) {
if (_check_locale_and_function())
- return ngettext($single, $plural, $number);
- else return _ngettext($single, $plural, $number);
+ return ngettext($singular, $plural, $number);
+ else return _ngettext($singular, $plural, $number);
}
function T_dgettext($domain, $msgid) {
if (_check_locale_and_function()) return dgettext($domain, $msgid);
else return _dgettext($domain, $msgid);
}
-function T_dngettext($domain, $single, $plural, $number) {
+function T_dngettext($domain, $singular, $plural, $number) {
if (_check_locale_and_function())
- return dngettext($domain, $single, $plural, $number);
- else return _dngettext($domain, $single, $plural, $number);
+ return dngettext($domain, $singular, $plural, $number);
+ else return _dngettext($domain, $singular, $plural, $number);
}
function T_dcgettext($domain, $msgid, $category) {
if (_check_locale_and_function())
return dcgettext($domain, $msgid, $category);
else return _dcgettext($domain, $msgid, $category);
}
-function T_dcngettext($domain, $single, $plural, $number, $category) {
+function T_dcngettext($domain, $singular, $plural, $number, $category) {
if (_check_locale_and_function())
- return dcngettext($domain, $single, $plural, $number, $category);
- else return _dcngettext($domain, $single, $plural, $number, $category);
+ return dcngettext($domain, $singular, $plural, $number, $category);
+ else return _dcngettext($domain, $singular, $plural, $number, $category);
}
function T_pgettext($context, $msgid) {
@@ -451,26 +452,27 @@ function T_dcpgettext($domain, $context, $msgid, $category) {
return _dcpgettext($domain, $context, $msgid, $category);
}
-function T_npgettext($context, $singular, $plural) {
+function T_npgettext($context, $singular, $plural, $number) {
if (_check_locale_and_function('npgettext'))
- return npgettext($context, $single, $plural, $number);
+ return npgettext($context, $singular, $plural, $number);
else
- return _npgettext($context, $single, $plural, $number);
+ return _npgettext($context, $singular, $plural, $number);
}
-function T_dnpgettext($domain, $context, $singular, $plural) {
+function T_dnpgettext($domain, $context, $singular, $plural, $number) {
if (_check_locale_and_function('dnpgettext'))
- return dnpgettext($domain, $context, $single, $plural, $number);
+ return dnpgettext($domain, $context, $singular, $plural, $number);
else
- return _dnpgettext($domain, $context, $single, $plural, $number);
+ return _dnpgettext($domain, $context, $singular, $plural, $number);
}
-function T_dcnpgettext($domain, $context, $singular, $plural, $category) {
+function T_dcnpgettext($domain, $context, $singular, $plural,
+ $number, $category) {
if (_check_locale_and_function('dcnpgettext'))
- return dcnpgettext($domain, $context, $single,
+ return dcnpgettext($domain, $context, $singular,
$plural, $number, $category);
else
- return _dcnpgettext($domain, $context, $single,
+ return _dcnpgettext($domain, $context, $singular,
$plural, $number, $category);
}
@@ -494,39 +496,39 @@ if (!function_exists('gettext')) {
function _($msgid) {
return __($msgid);
}
- function ngettext($single, $plural, $number) {
- return _ngettext($single, $plural, $number);
+ function ngettext($singular, $plural, $number) {
+ return _ngettext($singular, $plural, $number);
}
function dgettext($domain, $msgid) {
return _dgettext($domain, $msgid);
}
- function dngettext($domain, $single, $plural, $number) {
- return _dngettext($domain, $single, $plural, $number);
+ function dngettext($domain, $singular, $plural, $number) {
+ return _dngettext($domain, $singular, $plural, $number);
}
function dcgettext($domain, $msgid, $category) {
return _dcgettext($domain, $msgid, $category);
}
- function dcngettext($domain, $single, $plural, $number, $category) {
- return _dcngettext($domain, $single, $plural, $number, $category);
+ function dcngettext($domain, $singular, $plural, $number, $category) {
+ return _dcngettext($domain, $singular, $plural, $number, $category);
}
function pgettext($context, $msgid) {
return _pgettext($context, $msgid);
}
- function npgettext($context, $single, $plural, $number) {
- return _npgettext($context, $single, $plural, $number);
+ function npgettext($context, $singular, $plural, $number) {
+ return _npgettext($context, $singular, $plural, $number);
}
function dpgettext($domain, $context, $msgid) {
return _dpgettext($domain, $context, $msgid);
}
- function dnpgettext($domain, $context, $single, $plural, $number) {
- return _dnpgettext($domain, $context, $single, $plural, $number);
+ function dnpgettext($domain, $context, $singular, $plural, $number) {
+ return _dnpgettext($domain, $context, $singular, $plural, $number);
}
function dcpgettext($domain, $context, $msgid, $category) {
return _dcpgettext($domain, $context, $msgid, $category);
}
- function dcnpgettext($domain, $context, $single, $plural,
+ function dcnpgettext($domain, $context, $singular, $plural,
$number, $category) {
- return _dcnpgettext($domain, $context, $single, $plural,
+ return _dcnpgettext($domain, $context, $singular, $plural,
$number, $category);
}
}
diff --git a/libraries/php-gettext/gettext.php b/libraries/php-gettext/gettext.php
old mode 100644
new mode 100755
index 80d2497..5064047
--- a/libraries/php-gettext/gettext.php
+++ b/libraries/php-gettext/gettext.php
@@ -418,8 +418,14 @@ class gettext_reader {
}
function npgettext($context, $singular, $plural, $number) {
- $singular = $context . chr(4) . $singular;
- return $this->ngettext($singular, $plural, $number);
+ $key = $context . chr(4) . $singular;
+ $ret = $this->ngettext($key, $plural, $number);
+ if (strpos($ret, "\004") !== FALSE) {
+ return $singular;
+ } else {
+ return $ret;
+ }
+
}
}
hooks/post-receive
--
phpMyAdmin