Topic was automatically imported from the old Question2Answer platform.
Asked By
BadMother
Old Version
Published before Godot 3 was released.
I have set up a language selection menu that works on Windows but doesn’t work on the Android version. Is there a way to set the locale on Android after the game starts?
Thank you for your response. This app has a translation file with 10+ languages, so I need to be able to do something like:
TranslationServer.set_locale(lang_key)
And change the app locale setting regardless of the host locale.
I am not opposed to modifying my labels on scene load, I already have to do this to make sure the correct font is loaded, but I cannot have separate labels for each language. As best I can tell, Android does not easily allow the locale to be changed programmatically after runtime, so set_locale is not changing the app locale. Android developers may know a way around this, but I’m not sure what to do in Godot.
BadMother | 2017-12-10 12:34
I actually set the locale after start on android. It won’t change the labels of scenes already loaded but any other and it defines how the tr() function translates strings.
I have the feeling you try to update/save the locale in the project settings? That would only work in Windows (if at all). This is because the project settings reside in a read/only location on android.
Save the locale in a separate config in the users:// directory. Setting locales works on android. Verified on Godot 2.1.4.
wombatstampede | 2017-12-11 09:53
Thank you. After your reply I reworked some of my menu button code, and it works now. It must have been some coding error that Windows forgave but Android did not.
BadMother | 2017-12-11 12:19
Happy we could help.
B.t.w.: I found very little differences between Windows & Android when it came to coding. (Mostly file/system rights related or some ogg/mp3 playback/format hickups).