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 786704 - Can’t switch the currency order
Can’t switch the currency order
Status: RESOLVED FIXED
Product: gnome-software
Classification: Applications
Component: General
3.25.x
Other All
: Normal normal
: ---
Assigned To: GNOME Software maintainer(s)
GNOME Software maintainer(s)
Depends on:
Blocks:
 
 
Reported: 2017-08-23 21:07 UTC by Piotr Drąg
Modified: 2018-01-03 17:06 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
lib: Add a comment for translators (1020 bytes, patch)
2017-12-04 18:34 UTC, Piotr Drąg
committed Details | Review

Description Piotr Drąg 2017-08-23 21:07:34 UTC
This:

#: lib/gs-price.c:129
#, c-format
msgid "%s %f"
msgstr "%f %s"

produces this:

$ msgfmt -cvo /dev/null po/pl.po
po/pl.po:2124: format specifications in 'msgid' and 'msgstr' for argument 1 are not the same
msgfmt: found 1 fatal error


Obviously, many languages prefer “12 USD” to “USD 12”.
Comment 1 Richard Hughes 2017-08-23 21:11:21 UTC
What's the proper way to fix this? Thanks.
Comment 2 Piotr Drąg 2017-08-23 21:22:21 UTC
I don’t know about “proper”, but here is the same thing in gnome-calculator that doesn’t trip over gettext: https://git.gnome.org/browse/gnome-calculator/tree/lib/unit.vala#n125
Comment 3 Christian Persch 2017-08-24 08:15:40 UTC
The proper way to fix this is to use positional parameters in the translation, e.g.:

msgstr "%2$f %1$s"

See the gettext manual for more info.
Comment 4 Christian Persch 2017-08-24 11:19:07 UTC
Also, %f is not the right way to print a fractional price. See the glibc documentation on 'struct lconv' for more information.
Comment 5 Piotr Drąg 2017-12-04 18:34:02 UTC
Created attachment 364942 [details] [review]
lib: Add a comment for translators

Explaining how you can switch the currency order to your locale’s convention.
Comment 6 Richard Hughes 2017-12-05 10:31:58 UTC
Don't we also want to use NC_? "%s %f" isn't super-useful, and I can see it being used elsewhere. As usual, not the expert here.
Comment 7 Piotr Drąg 2017-12-05 15:44:54 UTC
I can’t find another %f in <https://l10n.gnome.org/POT/gnome-software.master/gnome-software.master.pot>, so there is nothing to disambiguate it from (C_). I can’t tell if N_ is needed — that’s a coding issue.
Comment 8 Piotr Drąg 2018-01-03 17:06:15 UTC
Comment on attachment 364942 [details] [review]
lib: Add a comment for translators

Pushed, we can always improve it later.

https://git.gnome.org/browse/gnome-software/commit/?id=71b6476a4827bf45be3e3eedd6b29b8133214e8e