NaomiProject / Naomi

The Naomi Project is an open source, technology agnostic platform for developing always-on, voice-controlled applications!
https://projectnaomi.com/
MIT License
242 stars 47 forks source link

Fix Translations #401

Closed aaronchantrill closed 4 months ago

aaronchantrill commented 4 months ago

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:

Computer: Je suis Computer
Computer: Comment puis-je être utile?

Types of changes

Checklist: