ods777/selfdrive/ui/translations
FrogAi 7852d4cbbf openpilot v0.9.7 release
date: 2024-06-11T01:36:39
master commit: f8cb04e4a8b032b72a909f68b808a50936184bee
2024-06-14 08:48:06 -07:00
..
README.md openpilot v0.9.7 release 2024-06-14 08:48:06 -07:00
auto_translate.py openpilot v0.9.7 release 2024-06-14 08:48:06 -07:00
create_badges.py openpilot v0.9.7 release 2024-06-14 08:48:06 -07:00
languages.json openpilot v0.9.7 release 2024-06-14 08:48:06 -07:00
main_ar.ts openpilot v0.9.7 release 2024-06-14 08:48:06 -07:00
main_de.ts openpilot v0.9.7 release 2024-06-14 08:48:06 -07:00
main_en.ts openpilot v0.9.7 release 2024-06-14 08:48:06 -07:00
main_fr.ts openpilot v0.9.7 release 2024-06-14 08:48:06 -07:00
main_ja.ts openpilot v0.9.7 release 2024-06-14 08:48:06 -07:00
main_ko.ts openpilot v0.9.7 release 2024-06-14 08:48:06 -07:00
main_nl.ts openpilot v0.9.7 release 2024-06-14 08:48:06 -07:00
main_pl.ts openpilot v0.9.7 release 2024-06-14 08:48:06 -07:00
main_pt-BR.ts openpilot v0.9.7 release 2024-06-14 08:48:06 -07:00
main_th.ts openpilot v0.9.7 release 2024-06-14 08:48:06 -07:00
main_tr.ts openpilot v0.9.7 release 2024-06-14 08:48:06 -07:00
main_zh-CHS.ts openpilot v0.9.7 release 2024-06-14 08:48:06 -07:00
main_zh-CHT.ts openpilot v0.9.7 release 2024-06-14 08:48:06 -07:00

README.md

Multilanguage

languages

Contributing

Before getting started, make sure you have set up the openpilot Ubuntu development environment by reading the tools README.md.

Policy

Most of the languages supported by openpilot come from and are maintained by the community via pull requests. A pull request likely to be merged is one that fixes a translation or adds missing translations.

We also generally merge pull requests adding support for a new language if there are community members willing to maintain it. Maintaining a language is ensuring quality and completion of translations before each openpilot release.

comma may remove or hide language support from releases depending on translation quality and completeness.

Adding a New Language

openpilot provides a few tools to help contributors manage their translations and to ensure quality. To get started:

  1. Add your new language to languages.json with the appropriate language code and the localized language name (Traditional Chinese is 中文(繁體)).
  2. Generate the XML translation file (*.ts):
    selfdrive/ui/update_translations.py
    
  3. Edit the translation file, marking each translation as completed:
    linguist selfdrive/ui/translations/your_language_file.ts
    
  4. View your finished translations by compiling and starting the UI, then find it in the language selector:
    scons -j$(nproc) selfdrive/ui && selfdrive/ui/ui
    
  5. Read Checking the UI to double-check your translations fit in the UI.

Improving an Existing Language

Follow step 3. above, you can review existing translations and add missing ones. Once you're done, just open a pull request to openpilot.

Checking the UI

Different languages use varying space to convey the same message, so it's a good idea to double-check that your translations do not overlap and fit into each widget. Start the UI (step 4. above) and view each page, making adjustments to translations as needed.

To view offroad alerts:

With the UI started, you can view the offroad alerts with:

selfdrive/ui/tests/cycle_offroad_alerts.py

Updating the UI

Any time you edit source code in the UI, you need to update the translations to ensure the line numbers and contexts are up to date (first step above).

Testing

openpilot has a few unit tests to make sure all translations are up-to-date and that all strings are wrapped in a translation marker. They are run in CI, but you can also run them locally.

Tests translation files up to date:

selfdrive/ui/tests/test_translations.py

Tests all static source strings are wrapped:

selfdrive/ui/tests/create_test_translations.sh && selfdrive/ui/tests/test_translations

multilanguage_onroad