Localization does not work in Portuguese (Brazil) in iOS 8

I added localizable.string (Portuguese (Brazil)) for localization. Its work is for iOS version 9. But this is not for iOS 8. It is always shown in English. I saw some forums, they suggested changing “Portuguese (Brazil)) to“ pt-BR ". But, for a localized string file, I can’t double-click to edit it. How to fix this, any suggestions. Thanks!

+4
source share
1 answer

I finally fixed it. I hope that in the future this will help someone who has the same problem.

NSString *preferredLanguage = [[NSLocale preferredLanguages] objectAtIndex:0];
NSLog(@"%@", preferredLanguage);

      if(IS_OS_9_BEFORE) {
 if ([preferredLanguage isEqualToString:@"pt"]) { 

            [[BundleLocalization sharedInstance] setLanguage:@"pt-BR"];
        }
      }

and don't forget to import the following classes from git.

https://github.com/cmaftuleac/BundleLocalization

+1

Source: https://habr.com/ru/post/1649772/


All Articles