GNOME Bugzilla – Bug 353236
Overloaded plural strings
Last modified: 2007-09-19 19:52:23 UTC
One msgid in sabayon has plural forms with both c-format and non-c-format, and the non-c-format one is unfortunately shared with some other non-c-format string. This causes trouble in translation for languages that have no plural form, such as Thai, Vietnamese, CJK, etc.: #: admin-tool/saveconfirm.py:71 admin-tool/saveconfirm.py:81 #, python-format msgid "If you don't save, changes from the last hour will be permanently lost." msgid_plural "" "If you don't save, changes from the last %d hours will be permanently lost." The singular form is from two places: #: admin-tool/saveconfirm.py:71 secondary_msg = _("If you don't save, changes from the last hour " "will be permanently lost.") #: admin-tool/saveconfirm.py:81 secondary_msg = gettext.ngettext ("If you don't save, changes from the last hour " "will be permanently lost.", "If you don't save, changes from the last %d hours" "will be permanently lost.", hours) % hours For languages with nplurals=1, translating this using a single msgstr[0] entry is impossible. With "%d" in translation, the raw placeholder will show up to user in the former. Without "%d", the latter just loose the number information.
Add I18N keyword.
Note: Fixes for this bug should be similar to Bug #353235.
Possible fix: Consider the relevant code around the string with plural form: ---8<--- if seconds < 55: ... elif seconds < 75: ... elif seconds < 110: ... elif seconds < 3600: ... elif seconds < 7200: ... else: hours = seconds / 3600; secondary_msg = gettext.ngettext ("If you don't save, changes from the last hour " "will be permanently lost.", "If you don't save, changes from the last %d hours " "will be permanently lost.", hours) % hours ---8<--- Obviously, seconds >= 7200 and hours >= 2, and the singular part of the string is never used. So, we can change it to any thing else to avoid merging with the non-c-format string at the other place, or even remove it: secondary_msg = _("If you don't save, changes from the last %d hours " "will be permanently lost.") % hours
Created attachment 71816 [details] [review] Proposed patch, removing unnecessary ngettext call The consequence of this patch is that languages with concept of plural forms just split their msgstr[0] and msgstr[1] for different msgid's, while languages without plurals then have a chance translate them separately.
See the fifth comment in bug #353236 to see how Nautilus handles this issue.
Created attachment 71824 [details] [review] Proposed patch using distinguished singular form OK. I switch to distinguished singular form approach, rather than removing ngettext(), as discussed in that bug.
Note: This bug still exists in Sabayon 2.17.90. Could sombody consider fixing it?
May I commit the last patch before upcoming string freeze? Note that the bug for similar code in gedit has also been fixed this way. (See Bug #353235)
Patch committed to HEAD, as there is no objection here. Closing bug, just re-open it on any problem. 2007-02-11 Theppitak Karoonboonyanan <thep@linux.thai.net> * admin-tool/saveconfirm.py (SaveConfirmationAlert.__init__): Do not overload singular form of formatted plural string with normal string, to allow translation for certain languages with no plural concept. Fixes bug #353236 - Overloaded plural strings.