]> git.wh0rd.org Git - tt-rss.git/commitdiff
Create table entries for plural forms and lookup them.
authorYak! <yak_ex@mx.scn.tv>
Sat, 13 Jul 2013 05:09:19 +0000 (14:09 +0900)
committerYak! <yak_ex@mx.scn.tv>
Sat, 13 Jul 2013 05:09:19 +0000 (14:09 +0900)
include/functions.php

index 1abaaf60f3621aa81d8088d2f8ff060c8e7ac85c..3c1956ea225710ef83979a1069d2fefdbee9e5ef 100644 (file)
                }
 
                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);
+                       }
                }
        }