I have a localized string that needs some variables. However, it is important in localization that the sequence of variables can change from language to language.
So this is not a good idea:
NSString * text = NSLocalizedString (@ "My birthday is @% @% @,");
Some words appear in front of others, whereas in the second it is reverse. At the moment I am lacking a good example
How do I provide the NAMED variable in the formatted string? Is there any way to do this without making a heavy self-made string replacement? Even some numbered variables such as {% @ 1}, {% @ 2} and so on will suffice ... Is there a solution?
This is the reason that NSLocalizedString
takes two parameters the original language meaning of the variable Use the second parameter to include a comment describing Then, translators can re-order them using the $
+ number creation. See the apple
Though you can not leave the parameters in one language For example, if you have 3 criteria in English and 4 in French and you do not need third in English, then you format like % 1 $ @% 2 $ @ and% 4 $ @
can not do. You can only leave the last one.
Comments
Post a Comment