IOS: get available locales in my project

I have created several .strings files for my application localization. Each of them corresponds to the language. Now I want to get a list of all available locales in my application. Is there any function that can help me do this?

eg. if my app just supports English, Chinese, French the function can return [en, zh, fr]

+3


source to share


1 answer


swift:

var availableLanguages = NSBundle.mainBundle().localizations as [String]

      



objc:

NSArray *availableLanguages = [[NSBundle mainBundle] localizations];

      

+2


source







All Articles