Latest | 0.0.9 |
---|---|
Homepage | https://github.com/k06a/ABLocalize |
License | MIT |
Platforms | ios 6.0, requires ARC |
Dependencies | JRSwizzle |
Authors |
Some localization tricks to support multiple targets
Usage
Just
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";
#else
#error One of macros APP1, APP2, APP3 should be defined!
#endif
// …
}
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.
Contribution
Feel free to discuss, pull request and tweet
Latest podspec
{ "name": "ABLocalize", "version": "0.0.9", "summary": "Some localization tricks to support multiple targets", "description": "You can develop several similar apps in one project by dividing themnby different targets. With this library you can vary texts by taggingnthem like this: `NSLocalizedString(@"LOGIN_INVITATION#APP1", @"")` and n`NSLocalizedString(@"LOGIN_INVITATION#APP2", @"")`.nWorks even for localized storyboard strings.", "homepage": "https://github.com/k06a/ABLocalize", "license": "MIT", "authors": { "Anton Bukov": "[email protected]" }, "platforms": { "ios": "6.0" }, "source": { "git": "https://github.com/k06a/ABLocalize.git", "tag": "0.0.9" }, "source_files": [ "Classes", "*.{h,m}" ], "requires_arc": true, "dependencies": { "JRSwizzle": [] } }
Thu, 03 Mar 2016 20:26:04 +0000