Closed RybenHill closed 1 year ago
Any reason for why naming the folder "strings"? Wouldn't it make more sense to just simply name it localisation?
well, I made that path suggestion inspired by how M&B manages thousands of translatable in-game text strings, with a smart way that allows new translations to be added and is open for mod creation.
It might be worth having a look at... https://mbmodwiki.github.io/String
Also, we could take into account this library...
https://github.com/MyreMylar/pygame_gui
https://github.com/MyreMylar/pygame_gui_examples
https://pygame-gui.readthedocs.io/en/v_067/
that might be useful for saving a lot of effort when implementing a GUI system for a Pygame project; it already includes its own localization support via python-i18n:
https://pygame-gui.readthedocs.io/en/latest/localization.html
https://github.com/danhper/python-i18n
https://pypi.org/project/python-i18n/
--
Ok, now I understand. But for this game I think it would be better to use localisation as folder name to make it more clear. Can you send an example of string file from mount and blade game? Would be useful to see how they structure the file.
In Mount and Blade, each game module (include the vanilla module or base game, what we are calling historial atm in our project) contains its own translation files:
module_dialogs.py, module_scripts.py, module_troops.py, module_infopages.py, etc.
Here you can read more about how its made in M&B:
For us, if we are using PygameGUI / python-i18n, the format expected would be something like...
{
"en": {
"text_id_whatever": "Hello world! :D"
}
}
As you can see and test yourself from the PygameGUI examples repo:
https://github.com/MyreMylar/pygame_gui_examples/blob/master/translations_test.py
So I remember I tried making localisation for UI before. I put the old file in dev branch:
It is not used in game yet but we can use it as a starting point.
https://github.com/remance/Masendor/tree/dev/data/module/historical/localisation
So the game now put localisation data separate from other data. They are kept in "localsiation" folder. The localisation files are in the same or similar name as the data. For example troop_status in localsation is for troop_status data. The data is in csv format to make it consistent with other data.
Forgot to mention that this change is in dev branch for now.
In order to make translation and development easier, separate game logic data from translatable strings in .csv files.
Put the translatable strings files in /masendor/data/module/historical/strings/*_en.csv