Reputation: 1
I am trying to localize a software. The source text has multiple different placeholders in a single string but they all look the same. For example, the original text would be: "%s of project %s". In this case, it's kind of obvious that the two string placeholders refer to different things. But the problem is that when translating this phrase to my language, the order of the two %s has to be reversed.
Since the two %s are not differentiated with numbers like %1s %2s, I'm assuming that the order matters and reversing the %s will result in a completely opposite translation. Am I correct?
Upvotes: 0
Views: 24
Reputation: 6690
You are correct, your runtime cannot magically know what you meant if you don't tell it.
You don't say what programming language is used and so what syntax of the format string is. Assuming that it is C or C-like and used with printf-family of functions, then the order can be specified: e.g. for this string:
"String `%s' has %d characters"
...a German translation would indicate positions thus:
"%2$d Zeichen lang ist die Zeichenkette `%1$s'"
See https://www.gnu.org/software/gettext/manual/html_node/c_002dformat-Flag.html
Upvotes: 0