I've successfully added a French localisation to my app. In XCode 4, it was just a case of selecting Localizable.strings and adding a new (French) localisation in the File Inspector. I then copy/pasted the French translation (from Word - unicode 16) into the new Localizable.strings (French) file that was generated.

I changed the language of the phone (both device and simulator) to French and removed the currently installed app, cleaned, and built.

Hey presto - everything's in French. Except that there are a few lines here and there that have remained in English. There seems to be no common element to these lines - either accents, formats or arguments.For example:

title = [NSString stringWithFormat:NSLocalizedString(@"You've just met %@", @"New friend message title"), self.friend.name];

/* New friend message title */  
"You've just met %@" = "Vous venez de rencontrer %@";

Still appears as 'You've just met ...' rather than in French. I can't seem to figure out why these few lines aren't translating when everything else is. Any help much appreciated!

Thanks, Michael.

有帮助吗?

解决方案

Microsoft Word is not a plain text editor, and it will modify text by replacing certain punctuation (apostrophes, quotes, dashes) with "smart" versions that look a bit nicer but might have random unicode code points.

I suggest checking that the apostrophe in "You've just met" is exactly the same character in your strings file as it is in your code source file. Maybe copy the "You've just met" from the strings file directly into the NSLocalizedString statement in your code and see if that helps.

I'd also recommend not using Microsoft Word to generate machine-readable strings unless you want a lot of headaches!

其他提示

You can't use high ascii characters in NSLocalizedString function.
To fix it simply change your key string:

title = [NSString stringWithFormat:NSLocalizedString(@"YouveJustMetStr", @"New friend message title"), self.friend.name];

"YouveJustMetStr" = "Vous venez de rencontrer %@";
许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top