Localizing concatenated or dynamic strings
- by SooDesuNe
I'm familiar with using NSLocalizedString() to localize strings, but the problem I have today requires a little more finesse. My situation is like this:
NSString *userName; //the users name, entered by the user. Does not need localized
NSString *favoriteFood; //the users favorite food, also entered by user, and not needing localized
NSString *summary = [NSString stringWithFormat:@"%@'s favorite food is %@", userName, favoriteFood];
This works fine for english, but not every language uses the same word ordering as English, for example, a word-by-word translation of the same sentance from Japanese into English would read:
UserName's favorite food pizza is
Not to mention that 's is doesn't make a possessive in every language.
What techniques are available for localizing this type of concatenated sentence?