To ensure our project remains highly usable and maintainable across the globe, every developer is required to follow the steps below for internationalization (i18n) processing before submitting code. This not only helps keep our codebase's internationalization up to date but also ensures a consistent experience for all users, regardless of their language.
Before you start, make sure you have the necessary tools installed:
- make
- gettext
Here are some ways to install gettext
:
sudo apt update
sudo apt install gettext
- Fedora:
sudo dnf install gettext
- CentOS/RHEL:
# CentOS/RHEL 7 And Older sudo yum install gettext # CentOS/RHEL 8 And Newer sudo dnf install gettext
sudo pacman -Sy gettext
brew install gettext
Please follow these steps to update and verify the project's internationalization files:
First, make sure the POT file contains the latest translatable strings.
make pot
This will scan all translatable strings in the source code and update the
locales/messages.pot
file.
Next, update the PO files for all languages to include any new or changed strings.
make po
If there are new translatable strings, this command will automatically add them to the PO files.
Ensure all new strings have been translated. Use your preferred PO file editor (like Poedit or Virtaal) for translation.
After translating, compile the PO files to generate the latest MO files.
make mo
This step is crucial because we've decided to include MO files in our GitHub submissions.
Before submitting, please test these translations in the application to ensure they work as expected and do not break any functionality.
After verifying that all translations are correct and functional, submit the changes of POT, PO, and MO files to your Git repository.
git add locales/
git commit -m "Update translations"
- Do not omit the submission of MO files; they are crucial for ensuring that all users can see the latest translations immediately.
- If you have any questions about the internationalization process or need help with translations, please contact the project maintainers promptly.
By following these steps, we can maintain a high level of internationalization in our project, providing a seamless experience for users worldwide. Thank you for your cooperation and contribution!
Running the following commands will automatically generate the latest translations:
python ./translate_util.py --lang zh_CN --modules app,core,model,rag,serve,storage,util
It will generate the latest translations for the specified modules and languages in the
directories locales/zh_CN/LC_MESSAGES/dbgpt_{module}_ai_translated.po
.
Check it and make sure it is correct. Then copy it to the locales/zh_CN/LC_MESSAGES/dbgpt_{module}.po
file.
Now support the following languages:
- zh_CN
- fr
- ko
- ru