For example, the player from Japan opens the game and appears in Japanese and the player from Brazil appears in Portuguese.
How can I do this?
For example, the player from Japan opens the game and appears in Japanese and the player from Brazil appears in Portuguese.
How can I do this?
Make this in a Javascript event:
runtimeScene.getGame().getVariables().get("language").setString(navigator.language || navigator.userLanguage);
This will make the user’s language in the global variable “language”.
Thanks but something doesn’t work because the game stops on the loading screen
I can resolve it. It’s very easy
1- Create an empty variable
2- Copy the next code in Js Editor
//set user language to variable
var Variable = navigator.language || navigator.userLanguage
//translate to Spanish
if (Variable === "es") {
objects[0].setString("hola");
}
//translate to English
if (Variable === "en") {
objects[0].setString("hello");
}
for mobile version is the same thing?
The platform shouldn’t matter. Ignacio’s code is weird, I am happy it worked out for him but it will not work for most people. I corrected my code and mine should work on any project.
I didn’t know this was possible! Thank you very much!