Changing language realtime doesn't work
I put the following code into the Start() method of a gameobject to change the language depending on the Application.SystemLanguage provided by Unity.
I tried also in the Awake method, without success.
SystemLanguage CurrentLanguage = Application.systemLanguage; if (Application.systemLanguage== SystemLanguage.French) LanguageManager.Instance.ChangeLanguage("fr");
By default, the dialoglanguage value is "en" setup in the TutorialSystem gameobject and his component SavePoint().
My computer is in French (well detected by Unity) , but the Tutorial doesn't switch to French version (of course, the French tuto is well displayed and works well, when the dialoglanguage value = "fr" by default.
Unity version = 2017.3.p4
tutoDesigner version = 1.3
Any idea ?
What you refer to is "the language the user's operating system is running in". Defined by Unity. That has nothing to do with SmartLocalization, the 3rd party plug I've compiled into the TutorialDesigner: https://github.com/NiklasBorglund/Smart-Localization-2
Changing the Language in runtime is pretty easy, and it applies in realtime:
That's it. You can execute this everywhere in your code. Hope it helps.
Thanks, but it doesn't work. The current language is always the language chosen in the listbox of the SavePoint component, even if we use your solution.
The listbox choice override the call of the API.
normally the listbox only overwrites the value when clicked - when the value is actively changed in the Editor. This should not be overwriting by default as I tested it myself. At runtime, there is no Editor code at all. So this isn't a problem either.
From where are you calling the trigger? In Start()? Then maybe it's overwritten by another Start function.
The call of the API is made in the Start() function.
There is no other call of this API in all the project.
We have two TutoSystem. The first in the 1st scene. This scene calls after one user action the 2nd scene which contains another Tutosystem GameObject linked to another Tutorial. Don't know if it helps or not.
The API call to change the language according to your code is made in the 1st scene.
Have you tried to call it with a little delay? I wonder if the call comes before the initialization has finished.
After adding a delay, it works.