0

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?

phi
  • 10,634
  • 6
  • 53
  • 88

2 Answers2

1

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.

Demz
  • 1,058
  • 9
  • 10
  • What do you mean by saying "keep only the fr.lproj"? And which plist entry do you mean? CFBundleDevelopmentRegion? I'd appreciate it if you could elaborate a bit more! – phi Mar 21 '12 at 18:16
  • create strings file normally, ex: "lr-back" = "Back" in the english version, and "lr-back" = "dos" in the french version; note that the key ("lr-...") can have any format you want, as long as its unique for each string; after you have these localization strings, the english one in the en.lproj, and the french one in the fr.lproj, you should have the app work in both english and french; so, after you do this, it's enough to keep only the fr.lproj, delete the en one, and it should always show only french words – Demz Mar 22 '12 at 08:12
1

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

Clafou
  • 15,250
  • 7
  • 58
  • 89