gpt4 book ai didi

ios - 如何在iOS中从NSLocale获取特定国家/地区的语言?

转载 作者:行者123 更新时间:2023-12-01 16:29:39 25 4
gpt4 key购买 nike

我是这里的新手,还是iOS开发的新手,我想从ios中的NSLocale获取特定国家/地区的语言吗?
我尝试使用此代码,但是它给了我所有语言,但是我想要特定的国家/地区语言

NSArray *test = [NSLocale availableLocaleIdentifiers];
for (int i = 0; i < [test count]; i++) {
NSLocale *locale = [NSLocale localeWithLocaleIdentifier:[test objectAtIndex:i]];
NSString *language = [locale displayNameForKey:NSLocaleIdentifier value:[locale localeIdentifier]];
NSLog(@"Langaugae %@",language);
}

我的意思是我想获得所有印度语言和任何其他乡村语言。
谢谢...

最佳答案

You will have to add localization.string file per language and then add string in key-value pair in that file.

For more detail , you can refer this link.
1.http://www.raywenderlich.com/64401/internationalization-tutorial-for-ios-2014
2.http://smoothlocalize.com/tutorial1.php
3.http://www.ibabbleon.com/iphone_app_localization.html

You can see steps for adding localization file for language in below image screenshot

关于ios - 如何在iOS中从NSLocale获取特定国家/地区的语言?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32521889/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com