#4872: Fix broken plural translation string
-------------------------------------------------+-------------------------
 Reporter:  Forgon                               |             Owner:
     Type:  patch (an actual patch, not a        |            Status:  new
  request for one)                               |         Milestone:
 Priority:  normal                               |  unspecified
Component:  Translation                          |           Version:
 Keywords:                                       |  git/master
 Blocking:                                       |        Blocked By:
                                                 |  Operating System:  All
                                                 |  /Non-Specific
-------------------------------------------------+-------------------------
 Recently, [https://github.com/Warzone2100/warzone2100/pull/259 pull
 request 259]
 could not be successfully merged because a translation string of ours
 contains
 different format strings for its singular and plural form in
 src/structure.cpp:

 {{{
                         console(ngettext("%s - %u Unit assigned - Damage
 %3.0f%%", "%s - %u Units assigned - Hitpoints %d/%d", assigned_droids),
 }}}

 This can result in broken translations as in the following example from PR
 259:
 {{{
 # Gruplar! -Ayhan
 #: src/structure.cpp:5447
 #, c-format
 msgid "%s - %u Unit assigned - Damage %3.0f%%"
 msgid_plural "%s - %u Units assigned - Hitpoints %d/%d"
 msgstr[0] "%s - %u Birim atandı - Hasar %%%3.0f"
 msgstr[1] "%s - %u Birim atandı - Sağlık %d/%d"
 }}}

 Because gettext compares all values in the msgstr array to the value of
 the
 msgid_plural field, the singular form will be treated as an error due to
 mismatching format specifiers: "%3.0f" is not identical to "%d" and "%d".

 This behavior makes sense because pluralization differs much across
 languages,
 with some languages like Japanese having no plural forms at all.

 The solution is to change the source code so that we use the same format
 string
 for both singular and plural forms, as we happen to do for any other
 message.

--
Ticket URL: <http://developer.wz2100.net/ticket/4872>
Warzone 2100 Trac <http://developer.wz2100.net/>
The Warzone 2100 Project

_______________________________________________
Warzone2100-project mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/warzone2100-project

Reply via email to