* Innitial commit Localization for retro-go using a simple 0(n) lookup function called rg_gettext() * adding language settings in options menu * adding more gettext() * new lookup function * adding "For these changes to take effect you must restart your device." gui alert + fixing gettext() function * modifying the gui dialog * updating struct syntax * update struct syntax (again) * creating the python tool for localization * updating tool + adding missing translations * moving stuff to libs + starting writing readme * adding missing "libs/localization" folder import in cmakelist + added the "fixme for rg_system" * synthax adjust + moving back stuff from libs to retro-go * removing trailing spaces * adding the enum for language ids * updating documentation according to the latest changes * small tweaks * Moved LOCALIZATION.md to the root folder Whilst it is mostly relevant to libretro-go, it really is project-wide documentation. * rg_localization: Got rid of the switch, made GUI dynamic This makes adding a language more straightforward. I kept the *msg *fr *en for now to avoid updating translations.h, but it could be replaced by the GCC extension as such: [RG_LANG_EN] = "...", [RG_LANG_FR] = "...", So that adding a language is really just updating the enum... * rg_localization: translations is const, we can use RG_COUNT * rg_gui: Fixed language selection * rg_localization: No need to validate rg_language in rg_gettext It should always be valid, there's no need to validate it. * rg_gui: Show language name in the log * rg_localization: Got rid of the Translation struct I am not 100% positive this is a good move... Benefits: - One less thing to change when adding a language - Less code is always better Cons: - It doesn't make it clear what the "key" is (the english text) - If in the future we need to add things like flags it will have to be returned to a struct * updated python tool + updating translations * added missing translations * audio filter wrong translation * fix : "a propose de retro-go" --------- Co-authored-by: Alex Duchesne <ducalex007@gmail.com>
33 lines
799 B
Markdown
33 lines
799 B
Markdown
This document describes the localization protocol used in Retro-go
|
|
|
|
|
|
# C files
|
|
translation.h contains the original messages (in english) and the corresponding translations ex:
|
|
````c
|
|
{
|
|
[RG_LANG_EN] = "Yes",
|
|
[RG_LANG_FR] = "Oui",
|
|
[RG_LANG_ES] = "Si",
|
|
},
|
|
````
|
|
|
|
If you want to add your own language :
|
|
|
|
You should update the enum accordingly (in rg_localization.h):
|
|
````c
|
|
typedef enum
|
|
{
|
|
RG_LANG_EN,
|
|
RG_LANG_FR,
|
|
|
|
RG_LANG_ES, // <-- to add spanish translation
|
|
|
|
RG_LANG_MAX
|
|
} rg_language_t;
|
|
````
|
|
|
|
|
|
# Python tool
|
|
`rg_locate_str.py` is a simple python tool that locate every string preceded by `_("` pattern in each file of Retro-go project
|
|
Then the tool compare theses strings to the ones in `translations.h` and put the missing ones in a .txt file called missing_translation.txt
|