0

I'm using localization for storyboard by auto layout for UI and localized strings for strings (I have one storyboard and add localization for strings only)

I have one project with two targets.

One of them should run only in English and the second should always run in Hebrew.

I tried to add a hack to force the application to be in Hebrew by adding this line to the main file:

NSUserDefaults * defaults = [NSUserDefaults standardUserDefaults];
[defaults setObject:[NSArray arrayWithObject:@"he"] forKey:@"AppleLanguages"];
[defaults synchronize];

But, this solution works only after I run the application twice.

I found another solution,

How to force NSLocalizedString to use a specific language

but it's not working at all.

Can you help me?

Thanks...

Community
  • 1
  • 1
zeevblu
  • 1,059
  • 2
  • 11
  • 26
  • Why use localization at all if you have separate targets for each language? Can you just add a different storyboard to each target? – Aaron Brager Feb 23 '15 at 15:04
  • Because all code is shared, The differences between targets is localization and some small isuues – zeevblu Feb 23 '15 at 15:06
  • 1
    You can still share your code with multiple targets, and get the localized string programmatically - see https://github.com/ArtSabintsev/Harpy/blob/master/Harpy/Harpy.m for an example of forced localization. – Aaron Brager Feb 23 '15 at 15:10
  • I know, I'm using targets, but the localization definition is only in the project settings. – zeevblu Feb 23 '15 at 15:11
  • The problem is localization of UI not strings. In Auto layout there is concept for localized RTL to LTR by constraints. and this is my problem – zeevblu Feb 23 '15 at 15:33

0 Answers0