Open SammygoodTunes opened 1 month ago
I can do that i guess if you want bro ðŸ¤
Sure.
Here's some info to get you started:
en.yml
and fr.yml
are both files containing translations to various texts in the gameIf you want to create a new language:
en.yml
)en.yml
, then the locale namespace must be en:
game/utils/translator.py
module - this is how the language appears in the language SelectBox (in the options menu)If you're adding a new translated text to one of the language files:
# en.yml
en:
world:
themes:
default: Default
translate()
method of the UI that you want to translate (all UIs are found in the game/gui/screens
package) - this is where you'll update all the UI components' text:from game.utils.translator import translator as t # Importing the translator module
t.t('path.to.translated.text') # Getting the translated text using the translator
# The setter functions for changing the text varies from widget to widget:
label.set_text(TEXT_HERE) # For labels
button.label.set_text(TEXT_HERE) # For buttons
checkbox.title_label.set_text(TEXT_HERE) # For checkboxes
selectbox.set_tooltip_text(TEXT_HERE) # For selectboxes
# etc.
translate()
method in the game/gui/screen_manager.py:perform_translate()
method, and it should be good.Feel free to look at the game/gui/screens/options_screen
module if you need an example, the translation for that screen is done.
Si jamais tu vois des corrections à faire au niveau de ce qu'il y a déjà dans les fichiers yml (ou à l'avenir), n'hésites pas bien sûr.
Implement text translation and a language menu.