We ran into several problems with translations today. The biggest was that because the i18n module is being initialized in the GenericPlugin class in naomi/plugin.py, every plugin was looking for its phrases in naomi/data/locale, so most translations were failing even after updating the .po files.
The next was that the first line Naomi speaks "My name is {}" had the format inside the parameter being passed to GetText, so the string was getting the name substituted before attempting to find a matching string in the .po file, so most names were causing that to default to english.
Finally, even when passing the "My name is {}" string correctly, the French .po file had no translation in the match for it, and the "My name is {} but you can also call me {}" line was not even included in the translation file, plus I was not even attempting to use gettext on the " or " string.
Now that all these issues are fixed, when I start Naomi in French I get the proper startup message:
Computer: Je suis Computer
Computer: Comment puis-je être utile?
Types of changes
[X] Bug fix (non-breaking change which fixes an issue)
[ ] New feature (non-breaking change which adds functionality)
[ ] Breaking change (fix or feature that would cause existing functionality to change)
Checklist:
[X] My code follows the code style of this project.
[ ] My change requires a change to the documentation.
Description
We ran into several problems with translations today. The biggest was that because the i18n module is being initialized in the GenericPlugin class in naomi/plugin.py, every plugin was looking for its phrases in naomi/data/locale, so most translations were failing even after updating the .po files.
The next was that the first line Naomi speaks "My name is {}" had the format inside the parameter being passed to GetText, so the string was getting the name substituted before attempting to find a matching string in the .po file, so most names were causing that to default to english.
Finally, even when passing the "My name is {}" string correctly, the French .po file had no translation in the match for it, and the "My name is {} but you can also call me {}" line was not even included in the translation file, plus I was not even attempting to use gettext on the " or " string.
Now that all these issues are fixed, when I start Naomi in French I get the proper startup message:
Types of changes
Checklist: