I’m localizing my iPad/iPhone app by using genstrings Classes/*.m to generate the Localizable.strings file. Most strings work fine and I get the expected output, but with some strings genstrings is adding 1$ or 1$ in the middle of my format specifiers, like this:
/* No comment provided by engineer. */
"%@%i" = "%1$@%2$i";
/* No comment provided by engineer. */
"%@: %i" = "%1$@: %2$i";
/* No comment provided by engineer. */
"%@" = "%@";
I’ve not had this issue with other apps, and as you can see it’s not consistent. But it doesn’t appear to be random either as when I run genstrings on the same class files again the 1$‘s etc are always in the same spot.
I can leave them in and the strings work with the correct formatting, but I have been manually removing them because I’m not sure what the $ will do. It’s annoying to have to go through and manually update the strings (plus I’ll likely miss one eventually).
I’m thinking it could be a text encoding issue? Or can I safely leave them in my strings and just ignore them?
Those numbers refer to the argument position of the replacement value. For instance,
%2$imeans “replace this with the second argument, which should be an integer.” This is useful when localizing to languages that use different word arrangements, because things can be replaced in an order different from that of English.In other words, they’re safe to leave in or remove, and they’ll come in handy for natural-sounding translations to other languages.