Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

chaiwithcode/IDLocalizationManager-iOS

Folders and files

NameName
Last commit message
Last commit date

Latest commit

History

8 Commits

Repository files navigation

IDLocalizationManager

IDLocalizationManager is a localization manager class (singleon class) for Objective-C. provides efficient way of localisation of application without changing system language and without restarting device .

IDLocalizationManager

Usage :

Try out the included sample project.

How to use :

  • Drag IDLocalizationManager folder to your project

  • create a Localizable.strings file for each *.lproj folder (e.g. en.lproj, it.lproj, fr.lproj, de.lproj...)

  • import IDLocalizationManager.h in your class

    Note : localizable.string file must contain key and value pair in format of "key" = "value"; dont forgot the ;(semicolon) at the end of line , otherwise it will not compile.

  • use as follow :

NSString *localizedString = [[IDLocalizationManager sharedManager] localizedStringForKey:(@"Hello")]

or, much better

NSString *localizedString = LocalizedString(@"Hello");

Features :

1. Get current language

NSString *currentLanguageString = [[IDLocalizationManager sharedManager] currentLanguage];

or, much better

NSString *currentLanguageString = IDLocalizationCurrentLanguage;

2. Get default language

NSString *defaultLanguageString = [[IDLocalizationManager sharedManager] defaultLanguage];

or, much better

NSString *defaultLanguageString = IDLocalizationDefaultLanguage;

Set current language

[[IDLocalizationManager sharedManager] setCurrentLanguage:(@"en")];

or, much better

IDLocalizationSetLanguage(@"en");

3. Reset current language to Default language

[[IDLocalizationManager sharedManager] resetCurrentLanguageToDefault];

or, much better

 IDLocalizationResetLanguageToDefault;

Get DisplayName language

NSString *displayNameString = [[IDLocalizationManager sharedManager] displayNameForLanguage:(@"en")];

or, much better

NSString *displayNameString = IDLocalizationDisplayNameForLanguage(@"en");

4. Get languages supported by app

NSArray *availableLanguages = [[IDLocalizationManager sharedManager] availableLanguagesWithoutBase:true]

or, much better

NSArray *availableLanguages = IDLocalizationAvailableLanguages;

EasyMethods :

Macros are optional but life savier , it makes life easy. belows are available macros :

1.LocalizedString(@"Hello")
2.IDLocalizationSetLanguage(@"en")
3.IDLocalizationAvailableLanguages
4.IDLocalizationCurrentLanguage
5.IDLocalizationDefaultLanguage
6.IDLocalizationResetLanguageToDefault
7.IDLocalizationDisplayNameForLanguage(@"en")

License

Licensed under the New BSD License.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

Contributors

AltStyle によって変換されたページ (->オリジナル) /