GNOME Bugzilla – Bug 709907
l10n: Please avoid strings with two variables
Last modified: 2013-10-16 14:26:20 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.
(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.
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.
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!
Created attachment 257417 [details] [review] tests: Add imports.format test
Review of attachment 257417 [details] [review]: Awesome! This looks good to me.
Review of attachment 257143 [details] [review]: Looks good with test.
Attachment 257143 [details] pushed as 4f40866 - format: Add support for numbered arguments Attachment 257417 [details] pushed as c08e211 - tests: Add imports.format test