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 709907 - l10n: Please avoid strings with two variables
l10n: Please avoid strings with two variables
Status: RESOLVED FIXED
Product: gjs
Classification: Bindings
Component: general
unspecified
Other Linux
: Normal normal
: ---
Assigned To: gjs-maint
gjs-maint
Depends on:
Blocks:
 
 
Reported: 2013-10-11 12:23 UTC by Daniel Korostil
Modified: 2013-10-16 14:26 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
format: Add support for numbered arguments (3.20 KB, patch)
2013-10-13 04:29 UTC, Florian Müllner
committed Details | Review
tests: Add imports.format test (3.29 KB, patch)
2013-10-16 13:08 UTC, Florian Müllner
committed Details | Review

Description Daniel Korostil 2013-10-11 12:23:53 UTC
For example:
msgid "%s has been kicked by %s"

Sometimes translator has to use following pattern according to their language features:
msgstr "%s kicked %s"

However, these variables have accurate order, so there is no way to interpret them properly.
Comment 1 Florian Müllner 2013-10-13 04:27:53 UTC
(In reply to comment #0)
> For example:
> msgid "%s has been kicked by %s"
> 
> Sometimes translator has to use following pattern according to their language
> features:
> msgstr "%s kicked %s"

The usual way to address this is to translate the string as:
msgstr "%2$s kicked %$1s"

The only problem there is that gjs does not support numbered arguments in format strings ... yet.
Comment 2 Florian Müllner 2013-10-13 04:29:27 UTC
Created attachment 257143 [details] [review]
format: Add support for numbered arguments

When translating format strings with more than one conversion
specification, it may be necessary to change the order in which
arguments are applied. POSIX covers this use case by allowing
either numbered or unnumbered arguments, it makes sense for us
to support this as well.
Comment 3 Colin Walters 2013-10-15 22:22:54 UTC
Review of attachment 257143 [details] [review]:

Can you add a test case to...hey we don't have any tests for format.js.  You could be the first kid on your block to write one!  Think about the fame and glory!
Comment 4 Florian Müllner 2013-10-16 13:08:40 UTC
Created attachment 257417 [details] [review]
tests: Add imports.format test
Comment 5 Colin Walters 2013-10-16 14:17:13 UTC
Review of attachment 257417 [details] [review]:

Awesome!  This looks good to me.
Comment 6 Colin Walters 2013-10-16 14:17:32 UTC
Review of attachment 257143 [details] [review]:

Looks good with test.
Comment 7 Florian Müllner 2013-10-16 14:26:12 UTC
Attachment 257143 [details] pushed as 4f40866 - format: Add support for numbered arguments
Attachment 257417 [details] pushed as c08e211 - tests: Add imports.format test