Localization revert to default fails
Posted: Sat Oct 05, 2019 7:55 pm
Hello,
I wanted to test localization of UI elements with Text Tables, but I ran into a problem. Resetting to default language after switching languages doesn't seem to work. I'll explain what I did so far:
I have this simple options menu with 3 buttons, English, Deutsch (German language) and Back. In this menu, I want to set the player language before the game starts. For this, I did the following:
- create a Text Table called "UI elements" with two languages, Default (I didn't change that one) and de (german). I translated the fields accordingly.
- Added a Localize UI script to the button "Back" that links to the field "Back" in my Text Table
- Add an OnClickListener to the language Buttons, which will call the following methods in my Menu.cs file:
- Added the Text Table to the Localization Settings in my Dialogue Manager
- Added a Localization UI Manager to my Dialogue Manager to save language settings and add the table here as well (not sure if any changes need to be done here or in the Localization settings)
When I start now a new game, a scene is loaded with my main menu, the default language is English. Then I want to go to the options menu (a second scene) and change the language. On the option screen, the following works:
Testcase #1
- click on "Deutsch" button
- back button text changes to german translation
- I get the log message that the language is set to german
- clicking on back button button shows the german translation of the main menu.
But this doesn't work
Testcase #2
- go to options menu
- click on "Deutsch" button
- I get the log message that the language is set to german
- change your mind and click on "English" button again
-> the text of the back button stays in german language. Also, I don't get a log message that the language was set to english
But still it somehow does seem to change the language, if I click on the back button after doing testcase 2, the main menu is in English. Also when I go back to the options menu again (loading options scene), I cannot successfully click on "English" after having clicked on "German" in the same run.
But I'm wondering, why it is not working on the same screen, whereas it is working fine for setting a defined language. As written above, I tried both options, DialogueManager.SetLanguage("") and DialogueManager.SetLanguage(null), the result stays the same. Am I missing something here? How can I make the UI update in the same screen? In my opinion, it only seems to work if I first try to set the language to English before German, but then it never works again.
All the best,
Evelyn
I wanted to test localization of UI elements with Text Tables, but I ran into a problem. Resetting to default language after switching languages doesn't seem to work. I'll explain what I did so far:
I have this simple options menu with 3 buttons, English, Deutsch (German language) and Back. In this menu, I want to set the player language before the game starts. For this, I did the following:
- create a Text Table called "UI elements" with two languages, Default (I didn't change that one) and de (german). I translated the fields accordingly.
- Added a Localize UI script to the button "Back" that links to the field "Back" in my Text Table
- Add an OnClickListener to the language Buttons, which will call the following methods in my Menu.cs file:
Code: Select all
public void English() {
DialogueManager.SetLanguage(""); //I've tried this also with DialogueManager.SetLanguage(null);
Debug.Log("Language set to english");
}
public void German() {
DialogueManager.SetLanguage("de");
Debug.Log("Language set to german");
}
- Added a Localization UI Manager to my Dialogue Manager to save language settings and add the table here as well (not sure if any changes need to be done here or in the Localization settings)
When I start now a new game, a scene is loaded with my main menu, the default language is English. Then I want to go to the options menu (a second scene) and change the language. On the option screen, the following works:
Testcase #1
- click on "Deutsch" button
- back button text changes to german translation
- I get the log message that the language is set to german
- clicking on back button button shows the german translation of the main menu.
But this doesn't work
Testcase #2
- go to options menu
- click on "Deutsch" button
- I get the log message that the language is set to german
- change your mind and click on "English" button again
-> the text of the back button stays in german language. Also, I don't get a log message that the language was set to english
But still it somehow does seem to change the language, if I click on the back button after doing testcase 2, the main menu is in English. Also when I go back to the options menu again (loading options scene), I cannot successfully click on "English" after having clicked on "German" in the same run.
But I'm wondering, why it is not working on the same screen, whereas it is working fine for setting a defined language. As written above, I tried both options, DialogueManager.SetLanguage("") and DialogueManager.SetLanguage(null), the result stays the same. Am I missing something here? How can I make the UI update in the same screen? In my opinion, it only seems to work if I first try to set the language to English before German, but then it never works again.
All the best,
Evelyn