I would like to manage a multi language game.
The idea is to automatically reconosize the language in base of the device o.s. or browser (en, fr,it,…)and read the corresponding JSON file with all texts.
Then put the JSON in a global structured variable and USA the text.
Is it possible to do it with gdevelop?
- The standard functions for working with Json files, which are located in the Filesystem section, work only when exporting to a desktop application. In the browser and on mobile devices, these functions do not work.
- There is an extension to detect the current language.
- I have not seen any automatic mechanisms for localization, so you most likely need to do everything yourself: define the necessary keys (variables), fill in the necessary values at the start of the scene (depending on the language) and assign values to objects.
Thanks. The extension is perfect !!!
My idea was to give to the translator a file and load it directly without copy and paste each word into gdevelop GUI. I think itsnt possible now.
Thanks and regards,
However, it is not clear where to save the file (for each type of compilation).
An example is included with GDevelop called multi language menu:
The example is using structure variables to store all the text for each language which is probably not ideal if you have lots of text in your game because you keep all the text loaded in memory. So it is probably not the best choice for adventure games. But if you have only few text, mostly the menus and GUI, it is relatively simple way to go about it.
Yes, that’s what I meant. Example: Working with JSON - Learn web development | MDN
Also take advantage of @ddabrahim advice.
Sorry, English is not my first language and I use a translator a lot.
Update: If there is a lot of text and it is consistent, then you can also try using the extension with the dialog tree. As a replica, you can indicate just the necessary text, and branches of their translations into another language. But here you have to experiment, how convenient it is. http://wiki.compilgames.net/doku.php/gdevelop5/all-features/dialogue-tree
it works well.
Here the code: GitHub - jumpingjh/MultiLanguage: Manag Multi languge in GDevelop projects. Thanks to E1e5en