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 <barra_cuda@katamail.com> Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Michele Ballabio committed
Aug 3, 2008 at 13:12 UTC
fbbdaa5f425417e7fee83f543b1d03806f034cab
1 file changed
+11
-6
po/README
+11
-6
@@ -101,7 +101,7 @@ matching msgid lines. A few tips:
101
"printf()"-like functions. Make sure "%s", "%d", and "%%" in your
102
translated messages match the original.
103
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>$"
105
between '%' and the conversion ('s', 'd', etc.) to say "<number>-th
106
parameter to the format string is used at this point". For example,
107
if the original message is like this:
@@ -111,12 +111,17 @@ matching msgid lines. A few tips:
111
and if for whatever reason your translation needs to say weight first
112
and then length, you can say something like:
113
114
- "WEIGHT IS %2\$d, LENGTH IS %1\$d"
114
+ "WEIGHT IS %2$d, LENGTH IS %1$d"
115
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%%)"
125
126
- A long message can be split across multiple lines by ending the
127
string with a double quote, and starting another string on the next