Changing language on the fly, in running iOS, programmatically
This is a fairly old question, but I was just struggling with the same problem and found this solution:
http://aggressive-mediocrity.blogspot.com/2010/03/custom-localization-system-for-your.html
Which does exactly what you need (and might be helpful for others who with the same problem :)
Below link has a nice implementation of having custom language from with in the application.
manual language selection in an iOS-App (iPhone and iPad)
Attempted a SWIFT version find it here LanguageSettings_Swift
-anoop
yes, i had the same problem, then i managed it with my own language setting in my prefFile, where i set a variable for the language setting:
// write a new value in file and set the var- (void)changeLangInPrefFile:(NSString *)newLanguage { NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES); NSString *documentsDirectory = [paths objectAtIndex:0]; NSString *path = [documentsDirectory stringByAppendingPathComponent:@"myPreference.plist"]; NSMutableDictionary *data = [[NSMutableDictionary alloc] initWithContentsOfFile: path]; //here add elements to data file and write data to file [data setObject:newLanguage forKey:@"language"]; [data writeToFile:path atomically:YES]; [data release];// NSString *chosenLang; <- declared in .h file if (chosenLang != nil){ [chosenLang release]; chosenLang = nil; } chosenLang = [[NSString alloc] initWithString:(@"%@",newLanguage)];}// read the language from file and set the var:- (void)readFromFileInBundleDocuments { NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES); NSString *documentsDirectory = [paths objectAtIndex:0]; NSString *path = [documentsDirectory stringByAppendingPathComponent:@"myPreference.plist"]; NSMutableDictionary *savedStock = [[NSMutableDictionary alloc] initWithContentsOfFile:path]; NSString *chosenLangTemp = [savedStock objectForKey:@"language"]; NSLog (@"read in file: %@", chosenLangTemp); if (chosenLang != nil){ [chosenLang release]; chosenLang = nil; } chosenLang = [[NSString alloc] initWithString:(@"%@",chosenLangTemp)]; [savedStock release];}
then i load all the contents from different files depending on the languagefor example i can load "an_image_eng.png" or "an_image_ita.png", or have 2 different .xib fileand for the text to load i use different dictionary-files, one for each language, with all words/expressions translated, i just load the chosen one and read in it the right expression for every text to be load (the code to load it is similar to the method i wrote in this example, you can just arrange it to read the right word for every expression: just look at the value for objectForKey in the right dictionary file, where objectForKey is the word to translate and its value is the word translated)...