-
Notifications
You must be signed in to change notification settings - Fork 4.4k
Extract translation text and use AI to perform the translation #13411
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
1. add translate python tools; 2. translate current zh_CN text.
|
As discussed in the Issue this provides no mechanism for review. I'll go with what @hamishwillee says about being paranoid about blindly accepting translations not being a good idea. |
AI is anecdotally poor for technical docs. If it matters, you use humans. I think with flying robots it matters. A possibility though is to autopopulate every single string with an AI translation unapproved. Then only publish strings that are approved. This might make the translation process easier. That said, I'd rather stick with what we have - possibly adding AI integration to suggest strings though - if there is budget for buying the keys. |
I don't see that ability in the .ts file format spec. |
|
As I said in the issue
there are 2 functions for the python:
it does not care how you translate the text, by Crowdin or AI, and before you commit and push , you need confirm by |
You are missing the point that git diff is not the process we use to verify translations. We use Crowdin for that. Anyone can do translations on Crowdin, only certified approvers can approve those translations and only then do they come down in a pull request. Crowdin has full ui to handle that whole process. We can subvert that whole process with something new. Which is why I was looking at marking a translation as not yet approved in the .ts file. With that we could use the Crowdin approval process. But as far as I can tell it's not currently possible. |
|
|
I did a few tests, and it may be possible to import the files, forcing any changed values to be imported as unapproved (though we should only update those values in the file with AI values if they don't have translations). The question is if we want to. If we're not publishing values unless approved this does slightly reduce the work for translators, but I only see it as useful if the guessed translation by AI is good. Who knows. In any case up to you @DonLakeFlyer to decide if this approach is something you want to look more into. I don't have bandwidth to help for a while. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR adds Python-based translation tools to automate the extraction and translation of text for internationalization (i18n). The main contribution is a workflow that extracts untranslated strings from Qt .ts files, facilitates AI-assisted translation, and applies the translations back to the files. The PR includes a substantial set of Chinese (zh_CN) translations for the QGroundControl interface.
Key changes:
- Adds translation automation framework with dictionary-based text replacement
- Provides Chinese translations for ~3000+ UI strings in
qgc_json_zh_CN.ts - Includes comprehensive documentation for the translation workflow
Reviewed Changes
Copilot reviewed 4 out of 6 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
tools/translations/qgc_translate.py |
Main translation script that processes Qt .ts files and applies dictionary-based translations |
tools/translations/dict_base.py |
Abstract base class providing translation logic with HTML entity encoding/decoding |
tools/translations/dict_zh_CN.py |
Chinese dictionary implementation (currently minimal, used as template) |
tools/translations/Readme.md |
Documentation explaining the translation workflow and AI prompt templates |
translations/qgc_json_zh_CN.ts |
Updated Chinese translation file with thousands of translated strings |
| ] | ||
| try: | ||
| logger.info("start translate") | ||
| translater = QgcTranslater() |
Copilot
AI
Nov 15, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The variable name translater contains a spelling error. It should be translator (with 'o', not 'a').
|
|
||
| logger.info(f"source_path={source_path}, target_path={target_path}") | ||
| if os.path.exists(source_path): | ||
| translater.process_qt_file(source_path, target_path) |
Copilot
AI
Nov 15, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The variable name translater contains a spelling error. It should be translator (with 'o', not 'a').
| console_handler.setFormatter(console_formatter) | ||
| logger.addHandler(console_handler) | ||
|
|
||
| class QgcTranslater: |
Copilot
AI
Nov 15, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The class name QgcTranslater contains a spelling error. It should be QgcTranslator (with 'o', not 'a'). The word "translator" is the correct spelling in English.

Extract translation text and use AI to perform the translation.
Deails refer: #13410
Description
Test Steps
Checklist:
Related Issue
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.