Skip to content

Commit fbbdaa5

Browse files
chungaspearce
authored andcommitted
git-gui: add a part about format strings in po/README
This should help tranlators that need to reorder words and strings. Original explanation by Christian Stimming. Also remove unneeded backslashes. Signed-off-by: Michele Ballabio <[email protected]> Signed-off-by: Shawn O. Pearce <[email protected]>
1 parent 7cce5b2 commit fbbdaa5

File tree

1 file changed

+11
-6
lines changed

1 file changed

+11
-6
lines changed

po/README

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ matching msgid lines. A few tips:
101101
"printf()"-like functions. Make sure "%s", "%d", and "%%" in your
102102
translated messages match the original.
103103

104-
When you have to change the order of words, you can add "<number>\$"
104+
When you have to change the order of words, you can add "<number>$"
105105
between '%' and the conversion ('s', 'd', etc.) to say "<number>-th
106106
parameter to the format string is used at this point". For example,
107107
if the original message is like this:
@@ -111,12 +111,17 @@ matching msgid lines. A few tips:
111111
and if for whatever reason your translation needs to say weight first
112112
and then length, you can say something like:
113113

114-
"WEIGHT IS %2\$d, LENGTH IS %1\$d"
114+
"WEIGHT IS %2$d, LENGTH IS %1$d"
115115

116-
The reason you need a backslash before dollar sign is because
117-
this is a double quoted string in Tcl language, and without
118-
it the letter introduces a variable interpolation, which you
119-
do not want here.
116+
A format specification with a '*' (asterisk) refers to *two* arguments
117+
instead of one, hence the succeeding argument number is two higher
118+
instead of one. So, a message like this
119+
120+
"%s ... %*i of %*i %s (%3i%%)"
121+
122+
is equivalent to
123+
124+
"%1$s ... %2$*i of %4$*i %6$s (%7$3i%%)"
120125

121126
- A long message can be split across multiple lines by ending the
122127
string with a double quote, and starting another string on the next

0 commit comments

Comments
 (0)