NSLocale currentLocale always returns “en_US” not user's current language

后端 未结 9 1649
夕颜
夕颜 2020-11-30 21:28

I\'m in the processes of internationalizing an iPhone app - I need to make programmatic changes to certain views based on what the user\'s current locale is. I\'m going nut

9条回答
  •  有刺的猬
    2020-11-30 21:33

    for me, both

    NSString *localeString = [[NSLocale currentLocale] localeIdentifier];
    

    and

    NSArray *array = [NSLocale preferredLanguages];
    self.label.text = array[0];
    

    yield the same result when you're in a simulator.

提交回复
热议问题