id summary reporter owner description type status component version severity resolution keywords cc stage has_patch needs_docs needs_tests needs_better_patch easy ui_ux 6864 JavaScript i18n support can fail for languages with two plural forms Ramiro Morales nobody "If, as exemplified in the official GNU gettext [http://www.gnu.org/software/gettext/manual/html_node/Plural-forms.html#Plural-forms documentation], the plural form specification headers {{{ ""Plural-Forms: nplurals=2; plural=n != 1;\n"" }}} or {{{ ""Plural-Forms: nplurals=2; plural=n>1;\n"" }}} are used instead of {{{ ""Plural-Forms: nplurals=2; plural=n != 1 ? 1 : 0;\n"" }}} or {{{ ""Plural-Forms: nplurals=2; plural=n>1 ? 1 : 0;\n"" }}} respectively in a (Django or application) {{{djangojs.po}}} catalog, the {{{ngettext()}}} function fails because the first ones, being C language expressions, rely on the C feature that boolean expressions have to value zero or one. In !JavaScript, a boolean in the context of an array index doesn't evaluate to zero or one. See http://groups.google.com/group/django-users/browse_frm/thread/12f39fe090d39e78?hl=en for the original report by Julien. This could affect JS i18n for languages that use two-forms pluralization rules, i.e.: Danish, Dutch, English, Faroese, German, Norwegian, Swedish, Estonian, Finnish, Greek, Hebrew, Italian, Portuguese, Spanish, Esperanto, French, Brazilian Portuguese (see the GNU gettext documentation linked above.) The attached patch modifies the {{{pluralidx()}}} function to work on both scenarios. " closed Internationalization dev fixed Ready for checkin 1 0 0 0 0 0