GNOME Bugzilla – Bug 778786
Plural forms in transitPlan.js fails to be offered for translation
Last modified: 2017-02-20 20:13:44 UTC
Hi, I started translating gnome-maps on l10n.gnome.org but saw 3 strings that doesn't have a plural form. #: ../src/transitPlan.js:271 #, javascript-format msgid "%d minute" msgstr "n" #: ../src/transitPlan.js:278 #, javascript-format msgid "%d hour" msgstr "" #: ../src/transitPlan.js:280 #, javascript-format msgid "%d:%0d hour" msgstr "" Looking at the code shows lines like "return N_("%d minute", "%d minutes", mins).format(mins);", so the plural forms are in the code, but l10n.gnome.org does not pick them up for translation.
Looking at the description of gettext commands I wonder if "const N_ = imports.gettext.dgettext;" should be "const N_ = imports.gettext.ngettext;" instead in src/transitPlan.js. This is not enough to fix the problem for me though.
Apparently Polari is just using "ngettext()" directly, see: https://git.gnome.org//browse/polari/tree/src/userList.js#n234 . Maybe this is why it doesn't end up in the .pot file (that we define and use N_( ?).
Created attachment 346066 [details] [review] transitPlan: Use ngettext for pluralized durations Use ngettext() directly for pluralized translated strings dealing with durations of itineraries. Inspiration was taken from Polari.
(In reply to Marcus Lundblad from comment #3) > Created attachment 346066 [details] [review] [review] > transitPlan: Use ngettext for pluralized durations > > Use ngettext() directly for pluralized translated strings > dealing with durations of itineraries. > Inspiration was taken from Polari. Tested "make update-po" after applying this, and the plural forms are now in the translation correctly. Looks good to me.
*** Bug 778927 has been marked as a duplicate of this bug. ***
Review of attachment 346066 [details] [review]: \o/
Attachment 346066 [details] pushed as cb1743e - transitPlan: Use ngettext for pluralized durations