In the ios application there is a json file in which information is in English (text), and this information is displayed on the screens in the application. How to do that would display information from a similar json file, only with information in Russian, if Russian is selected in the iphone settings. On Android, this is done simply - json in English in res / raw, in Russian in res / raw-ru. In xcode I can not figure out how to do it.
- stackoverflow.com/questions/6310487/… - Max Mikheyenko
|
2 answers
If I understand you correctly, you should use NSLocalizedString. Under the link below you can find a description of this process.
https://www.raywenderlich.com/64401/internationalization-tutorial-for-ios-2014
|
If NSLocalizedString for some reason does not fit or does not want to change json, then you can take the current language and the desired file for it:
NSString * language = [[NSLocale preferredLanguages] objectAtIndex: 0]; if ([language rangeOfString: @ "ru"]. location! = NSNotFound) [self loadRuJson];
|