开发者

How can I get language setting of iPhone as Unity3D native function?

开发者 https://www.devze.com 2023-04-10 04:35 出处:网络
I\'ve try everything to find a way to get the language setting of iPhone via a native Unity3D function. however, I found two ways, those are:

I've try everything to find a way to get the language setting of iPhone via a native Unity3D function. however, I found two ways, those are:

1) use guiText.text = Application.systemLanguage.ToString(); But I always get 'Unknown' in Chinese language. 2) use NSUserDefaults and PlayerPrefs. B开发者_运维知识库ut it's not a Unity3D native function, I'll have to do some extra work when I want to develop my Android version.

So, anyone can please show me: Is there a PERFECT way to do that? Thank you very much!


I don't know what unity is, but would NSLocale or CFLocale help you? NSLocale is objective-c based and thus a bit easier to use:

http://developer.apple.com/library/mac/#documentation/Cocoa/Reference/Foundation/Classes/NSLocale_Class/Reference/Reference.html

CFLocale is c-based, so its a bit more tricky, but offers more functionality:

http://developer.apple.com/library/mac/#documentation/CoreFoundation/Reference/CFLocaleRef/Reference/reference.html

If you are looking for the current language code you should be able to grab the current locale and inspect that.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号