summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorYak! <[email protected]>2013-07-13 14:09:19 +0900
committerYak! <[email protected]>2013-07-13 14:09:19 +0900
commitda07af65d516b7e6492b21b21b555751c43c1d7f (patch)
treef272d9f0fe7b5e8c3947995ffe28fcc4f3742b60 /include
parent7a7a0dc2dd02c7064ce367004bd476345464d8cd (diff)
Create table entries for plural forms and lookup them.
Diffstat (limited to 'include')
-rw-r--r--include/functions.php13
1 files changed, 9 insertions, 4 deletions
diff --git a/include/functions.php b/include/functions.php
index 1abaaf60f..3c1956ea2 100644
--- a/include/functions.php
+++ b/include/functions.php
@@ -4270,16 +4270,21 @@
}
function ngettext(msg1, msg2, n) {
- return (parseInt(n) > 1) ? msg2 : msg1;
+ return __((parseInt(n) > 1) ? msg2 : msg1);
}';
$l10n = _get_reader();
for ($i = 0; $i < $l10n->total; $i++) {
$orig = $l10n->get_original_string($i);
- $translation = __($orig);
-
- print T_js_decl($orig, $translation);
+ if(strpos($orig, "\000") !== FALSE) { // Plural forms
+ $key = explode(chr(0), $orig);
+ print T_js_decl($key[0], ngettext($key[0], $key[1], 1)); // Singular
+ print T_js_decl($key[1], ngettext($key[0], $key[1], 2)); // Plural
+ } else {
+ $translation = __($orig);
+ print T_js_decl($orig, $translation);
+ }
}
}