I couldn't find any similar questions, so here we go:

I am working on an iOS app that for the first release will only be in french, but we plan to release an english version as well in the future. At this point, I thought it was a good idea to use NSLocalizedString for all the text, so that the app will be ready when the english language will be required. However, I would really like to use english as the key value in my code:

aString = NSLocalizedString(@"Yes", @"Text for positive answer");

instead of

aString = NSLocalizedString(@"Oui", @"Text for positive answer");

Then I want to run genstrings, and localize the .strings file in french (and give it to the translators). But if I do it like that, how can I get rid of the "original" english .strings file? Am I totally wrong here, and do I have to use french for now in my code?

有帮助吗?

解决方案

If you are developing the app in English and localizing it into French, I wonder why you would want to actively prevent the app from running in English. If some users in your target market (France only, I imagine?) prefer to run their iOS device in English language, why deny them their preferred language? Or is it because you won't be doing QA of the English version and therefore don't wish to expose it yet?

In any case, I believe that you can restrict the list of supported languages by simply editing your project metadata. In XCode the list of supporting languages is shown on this page -- simply remove English and I believe that your English localizations, even if they are present in your project, won't be used (I haven't tested this but I doubt it would delete your existing English files, it should just remove them from the application's supported languages list)

enter image description here

其他提示

You can do your whole project in english, keep english words for keys in the localizable.strings files, but keep only the fr.lproj folder, and in the plist set the supported languages only to french.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top