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 .
Try out the included sample project.
-
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");NSString *currentLanguageString = [[IDLocalizationManager sharedManager] currentLanguage];or, much better
NSString *currentLanguageString = IDLocalizationCurrentLanguage;NSString *defaultLanguageString = [[IDLocalizationManager sharedManager] defaultLanguage];or, much better
NSString *defaultLanguageString = IDLocalizationDefaultLanguage;[[IDLocalizationManager sharedManager] setCurrentLanguage:(@"en")];or, much better
IDLocalizationSetLanguage(@"en");[[IDLocalizationManager sharedManager] resetCurrentLanguageToDefault];or, much better
IDLocalizationResetLanguageToDefault;NSString *displayNameString = [[IDLocalizationManager sharedManager] displayNameForLanguage:(@"en")];or, much better
NSString *displayNameString = IDLocalizationDisplayNameForLanguage(@"en");NSArray *availableLanguages = [[IDLocalizationManager sharedManager] availableLanguagesWithoutBase:true]or, much better
NSArray *availableLanguages = IDLocalizationAvailableLanguages;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")
Licensed under the New BSD License.
