cancel
Showing results for 
Search instead for 
Did you mean: 

Localization in Unity

Wendall
Explorer
I'm in the process of setting up the different languages for our game. Unfortunately, I cannot find any documentation on how to get the current language setting which is set in the Oculus app. Inside of unity, I have tried checking Application.systemLanguage, but it always returns SystemLanguage.English, even if I changed the Language Preference from English (US) to Francais. 

For what it's worth, I set the language preference as follows: 
  1. I opened the Oculus app on your computer
  2. I clicked  and then selected Settings
  3. I clicked General in the left menu
  4. Then next to Language Preference, I clicked to change the language
Could someone please direct me to the documentation or an example showing how to get the desired language? 
7 REPLIES 7

vrdaveb
Oculus Staff
To change Application.systemLanguage, you need to set the device's locale via Settings -> Language and Keyboard Settings -> Select Language.

bpadget
Explorer
If you're using the Oculus Platform SDK you can call Oculus.Platform.CAPI.ovr_GetLoggedInUserLocale().  Please note that this function will only work on windows; on Android use the system locale.

Wendall
Explorer
I just downloaded the the Oculus Platform SDK found at this link:
https://developer3.oculus.com/downloads/platform/1.9.0/Oculus_Platform_SDK/

After I installed the unity package I did a find in files in all the *.cs files for the function mentioned above. I also looked for the word Locale, but there were no matches.

After that, I then did a search through all of files included in the zip file, but I didn't find anything there either. Is it possible that it is not included in that version? 

bpadget
Explorer
Sorry, it looks like this code was just added and won't be out until our 1.10 release.  That version should be available on the 10th.

Wendall
Explorer
Ah great! I look forward to the update. Thanks.

Qixotl
Honored Guest
<Shamelessly necros thread three years on>
I'm trying to do exactly this but Unity locks up as soon as it tries to compile a script with a call to Oculus.Platform.CAPI.ovr_GetLoggedInUserLocale() in it. I have to kill it in TargetManager. Commenting out the line makes everything fine again.

Do I need to do anything else in the project setup to use this DLL?

EDIT: Locking up without that line now, must be something unrelated - sorry!

glenneroovy
Protege

Sorry to necro this thread 3 years later... but I tried to call Oculus.Platform.CAPI.ovr_GetLoggedInUserLocale() to get the system language and it crashes Unity.

 

Is there a recommended way to get the system Locale?

 

EDIT: Nevermind, the solution is to call Users.GetLoggedInUserLocale() after calling Oculus.Platform.Core.AsyncInitialize(APPID); This returns for me "en-US-u-rg-uszzzz". I wonder if there is a list of Locales somewhere?