ABLocalize 0.0.9

ABLocalize 0.0.9

LangLanguage Obj-CObjective C
License MIT
ReleasedLast Release Oct 2015

Maintained by Anton Bukov.

  • By
  • Anton Bukov

Some localization tricks to support multiple targets



pod 'ABLocalize'

Assign ABLocalizeTag one of values from Build Settings -> Preprocessor Macros like this:

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
#ifdef APP1
    ABLocalizeTag = @"APP1";
#elif defined(APP2)
    ABLocalizeTag = @"APP2";
#elif defined(APP3)
    ABLocalizeTag = @"APP3";
    #error One of macros APP1, APP2, APP3 should be defined!

    // …

And you can tag all your localization string you want to depend on target:

"LOGIN_INVITATION#APP1" = "Welcome to Foo App";
"LOGIN_INVITATION#APP2" = "Welcome to Bar App";
"LOGIN_INVITATION#APP3" = "Welcome to Lol App";

Even in de.lproj/Main.strings for Main.stroyboard localization:

"I3Z-Vv-9QS.text" = "Herzlich Willkommen";
"I3Z-Vv-9QS.text#APP3" = "¯\_(ツ)_/¯";

App will try to get tagged version, if not exist - then get common version.


Feel free to discuss, pull request and tweet