From Fedora Project Wiki

Revision as of 14:53, 29 July 2020 by Rffontenelle (talk | contribs) (Add autolang)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Controlling parameters order

When translating, sometimes the translation of a particular string requires different parameter order. But it is usually not allowed to change them in the translated string. There is a workaround to change the order in translation, and it can be found with info gettext command.

For example; in German, this won't work:

msgid "String '%s' has %d characters\n"
msgstr "%d Zeichen lang ist die Zeichenkette '%s'\n"

In order to specify the parameter order, the number with $ mark can be given as below:

msgstr "%2$d Zeichen lang ist die Zeichenkette '%1$s'\n"


In some cases, you may see a string that looks like %(var)s. This is called a variable and can be moved within a string in any order.

msgid "String '%(str)s' has %(char)s characters\n"


msgstr "%(char)s Zeichen lang ist die Zeichenkette '%(str)s'\n"

No other changes are required.