lib: Upgrade php-gettext from 1.0.11 to 1.0.12
https://launchpad.net/php-gettext
The local change to rename the gettext_reader function to
__construct (commit 00b6b66827
) has been
preserved.
Signed-off-by: Anders Kaseorg <andersk@mit.edu>
This commit is contained in:
parent
e3cfa33ba9
commit
526096f06a
|
@ -174,14 +174,13 @@ function _get_codeset($domain=null) {
|
||||||
* Convert the given string to the encoding set by bind_textdomain_codeset.
|
* Convert the given string to the encoding set by bind_textdomain_codeset.
|
||||||
*/
|
*/
|
||||||
function _encode($text) {
|
function _encode($text) {
|
||||||
|
$target_encoding = _get_codeset();
|
||||||
|
if (function_exists("mb_detect_encoding")) {
|
||||||
$source_encoding = mb_detect_encoding($text);
|
$source_encoding = mb_detect_encoding($text);
|
||||||
$target_encoding = _get_codeset();
|
if ($source_encoding != $target_encoding)
|
||||||
if ($source_encoding != $target_encoding) {
|
$text = mb_convert_encoding($text, $target_encoding, $source_encoding);
|
||||||
return mb_convert_encoding($text, $target_encoding, $source_encoding);
|
}
|
||||||
}
|
return $text;
|
||||||
else {
|
|
||||||
return $text;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -350,6 +350,10 @@ class gettext_reader {
|
||||||
* @return int array index of the right plural form
|
* @return int array index of the right plural form
|
||||||
*/
|
*/
|
||||||
function select_string($n) {
|
function select_string($n) {
|
||||||
|
if (!is_int($n)) {
|
||||||
|
throw new InvalidArgumentException(
|
||||||
|
"Select_string only accepts integers: " . $n);
|
||||||
|
}
|
||||||
$string = $this->get_plural_forms();
|
$string = $this->get_plural_forms();
|
||||||
$string = str_replace('nplurals',"\$total",$string);
|
$string = str_replace('nplurals',"\$total",$string);
|
||||||
$string = str_replace("n",$n,$string);
|
$string = str_replace("n",$n,$string);
|
||||||
|
|
Loading…
Reference in New Issue