As the titel says, i search the forum and the Docs to no success. Are we able to check which dsiplay-language the User has configured ?
hmmm - after some research on c#/mono docs
i came so far to try “CultureInfo.CurrentCulture”, which should hold the current info, but returns an empty string ?
Fetching an Array of them via “GetCultures()” works, returning all possible entries, but the first (and supposed to be current setting) returns an empty String too.Is this a bug or not supported at all ?
Tried on OSX by the way.- but will test on Windows+iPhone…
It is working on Windows - so seems to be a OSX specific Bug:
CultureInfo.CurrentCulture and
Thread.CurrentThread.CurrentCulture
- works on Windows (2.5.1f5),
returns an empty String
- Unity OSX (2.5.1f5)
- Unity Iphone ( V1.5.0f3 )
okay found this thread
http://forum.unity3d.com/viewtopic.php?t=5912&highlight=currentculture
so in short - this has been open and known for 2yrs
and is still not solved ?
(okay - no hint for a bug report in this thread)
You can simple get the data from objc and store them in a userdefaults string to gather from playerprefs
That’s what I do; I didn’t even think to use CultureInfo.CurrentCulture (just as well since that doesn’t seem to work anyway).
–Eric
… to tell is easy but how do you get the data from objc ?
can’t find something in the DOC’s maybe you can give us a example Script ?
thank you very much !
kerstin ![]()
Yep - thanks - using Obj C directly was exactly my plan to do if nothing else in unity is able to do this. It’s time anyway to repolish my C coding skills and have a look at the way the Unity plugin feature works…
In applicationDidFinishLaunching of AppController.mm:
[[NSUserDefaults standardUserDefaults] setObject: [[NSLocale preferredLanguages] objectAtIndex:0] forKey: @"YourLanguageKey"];
In Unity:
PlayerPrefs.GetString("YourLanguageKey");
returns “en” for english, “fr” for french…
Hope it helps.
whoa - thanks a lot htkc !!!
you saved me from some headache, because today i agreed to a more or less tight deadline and some feature extension in the same meeting, so saving every possible minute of research and docs digging helps a lot
awesome man ! thanx again !
You’re welcome, it so happens that I was trying to do the same thing today as well.
Works like a charm. Thanks!