2

I have a single project which builds multiple Apps on a per target basis, in order to localize the Apps I can add localization languages to the project, but not on a per target basis. Meaning that any target we build will appear to support all localizations for the project. i.e. Target A must support English and French, but Target B must only support English.

Is there any way to add a localization language on a per target basis? Or is the correct way to do this, to branch the project and maintain different branches of the codebase with different localizations for different targets?

Sammio2
  • 7,422
  • 7
  • 34
  • 49
  • How are you using localization ? using iOS setting change language option or you have select language option at app startup etc. – Aditya Deshmane Nov 20 '13 at 10:34
  • The requirement is to use the iOS settings 'change language' option, and thus the built in support for localization. I suppose implementing a custom localization framework would allow for per target based localization. You do lose the ability to localize NIB files and images nicely in xcode doing that though. – Sammio2 Nov 20 '13 at 12:37
  • Take a look at this [answer](http://stackoverflow.com/questions/10523792/localized-project-with-several-targets-with-localized-app-names). – Paaske Jan 15 '15 at 07:16

2 Answers2

2

Let's try:

+ NSString* NSCustomLocalizedString( NSString *key , NSString *comment)
{
NSString *rs = nil;

#ifdef A //target A
    //you define English-French
    rs = NSLocalizedString(key,@"");
#else  //target B
    rs = NSLocalizedStringFromTable(key,@"Localizable.strings-en",nil);
return rs;
}
nmh
  • 2,497
  • 1
  • 15
  • 27
1
  1. Select the localizable.strings files for the language you need to remove from a target.

  2. Then remove the target membership for the selected files.

rustylepord
  • 5,681
  • 6
  • 36
  • 49