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?

3
  • How are you using localization ? using iOS setting change language option or you have select language option at app startup etc. Commented Nov 20, 2013 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. Commented Nov 20, 2013 at 12:37
  • Take a look at this answer. Commented Jan 15, 2015 at 7:16

2 Answers 2

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;
}
Sign up to request clarification or add additional context in comments.

Comments

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.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.