After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 669732 - Incorrect result of translation when identical strings are used both in single and plural-forms msgids
Incorrect result of translation when identical strings are used both in singl...
Status: RESOLVED FIXED
Product: gnome-settings-daemon
Classification: Core
Component: power
unspecified
Other Linux
: Normal normal
: ---
Assigned To: Richard Hughes
gnome-settings-daemon-maint
Depends on:
Blocks:
 
 
Reported: 2012-02-09 09:04 UTC by Marián Čavojský
Modified: 2012-06-14 10:08 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Power: Avoid duplicate translations (4.38 KB, patch)
2012-06-14 04:21 UTC, Matthias Clasen
accepted-commit_now Details | Review
power: Avoid duplicate translations (4.38 KB, patch)
2012-06-14 10:08 UTC, Matthias Clasen
committed Details | Review

Description Marián Čavojský 2012-02-09 09:04:54 UTC
In po file translations are mixed for single and plural forms strings. Translation of single form string leads to wrong translation because of incorrect usage of plural-form formula. The msgstr[0] is used instead of msgstr[1], see Plural-Forms definition for Slovak language.
Developers of gettext commends using context to avoid such ambiguities:
http://lists.gnu.org/archive/html/bug-gettext/2012-02/msg00003.html

Please add context to such strings:

Strings:
#: ../plugins/keyboard/keyboard.gnome-settings-plugin.in.h:1
#: ../plugins/power/gpm-common.c:585 ../plugins/power/gpm-common.c:872
msgid "Keyboard"
msgid_plural "Keyboards"

single form is in:
../plugins/power/gpm-common.c:872
../plugins/keyboard/keyboard.gnome-settings-plugin.in.h:1

#: ../plugins/mouse/mouse.gnome-settings-plugin.in.h:1
#: ../plugins/power/gpm-common.c:581 ../plugins/power/gpm-common.c:848
msgid "Mouse"
msgid_plural "Mice"

single form is in:
../plugins/mouse/mouse.gnome-settings-plugin.in.h:1
../plugins/power/gpm-common.c:848

#: ../plugins/power/gpm-common.c:565 ../plugins/power/gpm-common.c:757
msgid "AC adapter"
msgid_plural "AC adapters"

single form is in: ../plugins/power/gpm-common.c:757

#: ../plugins/power/gpm-common.c:569 ../plugins/power/gpm-common.c:793
msgid "Laptop battery"
msgid_plural "Laptop batteries"

single form is in: ../plugins/power/gpm-common.c:793

#: ../plugins/power/gpm-common.c:573 ../plugins/power/gpm-common.c:817
msgid "UPS"
msgid_plural "UPSs"

single form is in: ../plugins/power/gpm-common.c:817

#: ../plugins/power/gpm-common.c:577 ../plugins/power/gpm-common.c:824
msgid "Monitor"
msgid_plural "Monitors"

single form is in: ../plugins/power/gpm-common.c:824

#: ../plugins/power/gpm-common.c:589 ../plugins/power/gpm-common.c:896
msgid "PDA"
msgid_plural "PDAs"

single form is in: ../plugins/power/gpm-common.c:896

#: ../plugins/power/gpm-common.c:593 ../plugins/power/gpm-common.c:920
msgid "Cell phone"
msgid_plural "Cell phones"

single form is in: ../plugins/power/gpm-common.c:920

#: ../plugins/power/gpm-common.c:598 ../plugins/power/gpm-common.c:945
msgid "Media player"
msgid_plural "Media players"

single form is in: ../plugins/power/gpm-common.c:945

#: ../plugins/power/gpm-common.c:602 ../plugins/power/gpm-common.c:969
msgid "Tablet"
msgid_plural "Tablets"

single form is in: ../plugins/power/gpm-common.c:969

#: ../plugins/power/gpm-common.c:606 ../plugins/power/gpm-common.c:993
msgid "Computer"
msgid_plural "Computers"

single form is in: ../plugins/power/gpm-common.c:993
Comment 1 André Klapper 2012-02-09 12:13:22 UTC
(In reply to comment #0)
> Translation of single form string leads to wrong translation because of
> incorrect usage of plural-form formula.

How exactly is it incorrectly used? Any specific example?

> The msgstr[0] is used instead of msgstr[1]

For which exact case? Providing one example and explaining what exactly happens would be welcome...
Comment 2 Matthias Clasen 2012-06-14 04:21:42 UTC
Created attachment 216372 [details] [review]
Power: Avoid duplicate translations

It confuses our tools if we have the same msgid both in
gettext() and ngettext(), so be a bit more clever here.
Bonus: save 40 lines of code.
Comment 3 Bastien Nocera 2012-06-14 09:29:01 UTC
Review of attachment 216372 [details] [review]:

Too right.

It's "power" not "Power" though in the commit subject.
Comment 4 Matthias Clasen 2012-06-14 10:08:53 UTC
The following fix has been pushed:
ceeaf91 power: Avoid duplicate translations
Comment 5 Matthias Clasen 2012-06-14 10:08:55 UTC
Created attachment 216399 [details] [review]
power: Avoid duplicate translations

It confuses our tools if we have the same msgid both in
gettext() and ngettext(), so be a bit more clever here.
Bonus: save 40 lines of code.