Repository navigation
translating_with_ai
This page is for someone who wants QElectroTech's menus, dialogs and messages in their own language, or wants to finish a translation that has gaps, and would like an AI assistant to do the first draft. You need to speak the language: the AI drafts, you check, and the result goes to the project as a pull request.
There are two routes. Pick the one that matches the assistant you have:
| Your assistant | Route | What you need |
|---|---|---|
| Works on your computer and can run commands: Claude Code, GitHub Copilot in agent mode, Gemini CLI, Codex β¦ | Route 1 | Git, and the assistant does the rest, including the build |
| A chat window only: ChatGPT, claude.ai, Gemini, Le Chat β¦ | Route 2 | Python 3, and copy and paste |
Either way, read What a language is made of first. A translation file on its own does nothing: QElectroTech has to be told the language exists. A first pull request for Latvian (#1679) was complete and clean, yet merging it would have changed nothing, because the file was not listed anywhere.
The English text in the source code is the original. Each translation is one file, lang/qet_<code>.ts, an XML file holding every English string with its translation. The build turns each .ts into a .qm file that the program loads.
Updating a language that already exists touches only its .ts file.
Adding a new language touches five places. The examples use Latvian, code lv:
| File | What to add | Why |
|---|---|---|
lang/qet_lv.ts |
The translation itself | |
cmake/qet_compilation_vars.cmake |
${QET_DIR}/lang/qet_lv.ts in the TS_FILES list, in alphabetical order |
Without it the build never compiles or installs the file |
sources/qeticons.h and sources/qeticons.cpp
|
extern QIcon lv; in the .h; QIcon lv; and lv.addFile(":/ico/flags/lv.png"); in the .cpp, next to the other flags |
The flag shown in the language list. Most flags are already in ico/flags/ and in qelectrotech.qrc; check yours is |
sources/ui/configpage/generalconfigurationpage.cpp |
ui->m_lang_cb->addItem(QET::Icons::lv, tr("Latvian"), "lv"); in fillLang()
|
Without it nobody can choose the language in Settings β Configure QElectroTech, tab Languages |
sources/ElementsCollection/xmlelementcollection.cpp (optional)
|
names.addName("lv", "<Imported elements, in Latvian>"); |
The name of the "Imported elements" folder in each project |
Do not commit the .qm file. No language in the repository has one; the build makes it from the .ts.
- Check nobody is already on it. Search the open pull requests for your language.
-
Check whether the language already exists. The list is in the
langfolder. Ifqet_<code>.tsis there, you are updating, not adding. - Start from the current source. Strings are added every week. A translation made from an old copy misses them and is harder to merge.
Fork qelectrotech-source-mirror on GitHub, start your assistant in an empty folder and paste the prompt below. Change the two lines marked <>. If you have never built QElectroTech, Fix or add with an AI assistant covers installing the tools; come back here for the prompt.
I want QElectroTech's interface in <Latvian, code lv>. I speak it; you draft,
I review. <This is a new language / The language exists, fill its gaps>.
Stop and ask me before you delete files, install software or post anything
to GitHub. Anything you write for GitHub must follow
https://github.com/qelectrotech/qelectrotech-source-mirror/wiki/posting_with_ai_assistant
1. Clone my fork of qelectrotech-source-mirror, branch from the current
upstream master, and name the branch translation-<code>.
2. Read https://github.com/qelectrotech/qelectrotech-source-mirror/wiki/translating_with_ai
and follow its "What a language is made of" table. For a new language,
create the file with Qt's lupdate so it has the right plural forms:
lupdate sources -ts lang/qet_<code>.ts -target-language <code> -source-language en_US
For an existing language, run the same command without -target-language
to add the new strings.
3. Translate every string whose translation is empty or marked unfinished.
Rules:
- Keep every %1, %2, %n placeholder, every HTML tag and every link exactly.
- Keep the & that marks the Alt-key letter (&File); put it on a letter
of the translated word, unique within its menu.
- Keep a trailing "..." or "β¦" on menu items that open a dialog.
- Plural strings (numerus="yes") need one form per plural form of the
language; lupdate created the right number of empty forms.
- Use the electrical trade words of my country: sheet (also called folio),
symbol (called element in the code), wire (conductor), terminal,
title block, cross-reference. Use the same word for the same thing
everywhere.
- Leave names as they are: QElectroTech, Qt, file extensions, colour
names after a colon ("White : WhiteSmoke" keeps "WhiteSmoke").
- Leave every translation you write marked type="unfinished"; I mark
them done when I have read them.
Work in batches of about 150 strings and show me progress.
4. Download qet_ts_tool.py from the wiki page above and run
python3 qet_ts_tool.py check lang/qet_<code>.ts
Fix every problem it lists.
5. For a new language, make the code changes in the table (TS_FILES, the
flag icon, the Settings list). Build QElectroTech, start it, switch to
my language in Settings β Configure QElectroTech β Languages, restart it
and show me a screenshot of the main window and of one dialog.
6. Tell me how many strings you translated and how many are left, then wait
while I review in Qt Linguist.
7. After my review, commit only the files in the table (never the .qm) and
help me open a pull request. The description says the draft was made
with an AI assistant, who reviewed it, and how many strings are
reviewed versus still marked unfinished.
A chat assistant cannot be trusted to copy a 25 000-line XML file back without damaging it, and the file is too large for one message anyway. So the AI never sees the XML. A small script, qet_ts_tool.py, takes the strings that still need a translation out of the .ts file in numbered batches, and puts the answers back.
You need Python 3 (Windows: from python.org, tick Add to PATH).
- Download your language's file from the
langfolder (click the file, then the download button). For a new language, ask on the forum or in a GitHub discussion for an empty file made with lupdate, or use Route 1. An empty file has to come from lupdate, because it sets up the plural forms. - Download
qet_ts_tool.pyinto the same folder.
python3 qet_ts_tool.py export qet_lv.tsThis writes qet_lv.batch-001.json, qet_lv.batch-002.json β¦ with 150 strings each, and only the strings that have no translation yet. Use --size 80 if your assistant cuts its answers short. Each entry looks like this:
{"id": 149, "en": "%n elements will receive the β%1β numbering, in sheet and position order.", "plural_forms": 3}Paste this prompt into the chat once, at the start. Change <Latvian>:
You will translate the interface of QElectroTech, an electrical diagram
editor, from English into <Latvian>. I am a native speaker and will review
your work.
I will send batches as JSON. Answer each batch with JSON only: the same
list, the same "id" and "en" for each entry, plus a "tr" field with the
translation. If an entry has "plural_forms": N, "tr" is a list of N
strings, one per plural form of <Latvian>, in Qt's order. If an entry has a
"note", it explains the context; do not translate it.
Rules:
- Keep every %1, %2, %n placeholder, every HTML tag and every link exactly.
- Keep the & that marks the Alt-key letter (&File); put it on a letter of
the translated word.
- Keep a trailing "..." or "β¦".
- Use the electrical trade words used in <Latvia>: sheet (also called folio),
symbol (called element in the code), wire (conductor), terminal, title
block, cross-reference. Use the same word for the same thing every time.
- Leave names as they are: QElectroTech, Qt, file extensions, colour names
after a colon ("White : WhiteSmoke" keeps "WhiteSmoke").
- Do not skip entries and do not add any.
Reply "ready" and wait for the first batch.
Then for each batch: open the .json file in a text editor, copy all of it into the chat, and save the answer as answer-001.json, answer-002.json β¦ next to the other files. If the answer is cut off, ask "continue from id N" and join the two parts, or export again with a smaller --size.
python3 qet_ts_tool.py import qet_lv.ts answer-*.jsonThe script checks each answer belongs to that file (the English text must match its id) and refuses the whole import if one does not, leaving the file as it was. It also refuses an answer that is not valid JSON; ask the AI to send that batch again. Everything it imports stays marked unfinished until you review it.
The AI's draft is a draft. Open the .ts file in Qt Linguist (it comes with Qt; on Ubuntu or Debian, the linguist-qt6 package), read each string, correct it, and press Ctrl+Enter to mark it done.
-
lang/phrase/qet_en_<code>.qphis a phrase book for your language. Phrases β Open Phrase Book in Qt Linguist shows its suggestion next to each string, which helps keep words consistent. Many entries were made by machine translation, so check them too. - Read the menus first: they are what everybody sees.
- Strings you have not reviewed can stay unfinished. They are still built into the program, and the next translator knows which ones to look at.
python3 qet_ts_tool.py check qet_lv.tsIt lists every string that would show wrong in the program, and prints a count at the end:
| Problem it reports | What goes wrong in QElectroTech |
|---|---|
| placeholders differ | A number or name is missing from the message, or the wrong one is shown |
| HTML tags differ | Formatting breaks, or a line break disappears |
| link not in the English | A link points somewhere the original did not |
| lost its Alt-key letter (&) | The menu item can no longer be reached with the keyboard |
| trailing '...' added or lost | A menu item no longer shows that it opens a dialog |
| N plural forms, needs M | A count shows the wrong grammatical form |
If you have Qt installed, also run lrelease qet_lv.ts: it must finish without an error.
Open a pull request with only the files from the table. In the description, say:
- which language, and whether it is new or an update;
- that the draft was made with an AI assistant, and who reviewed it;
- how many strings are reviewed and how many are still unfinished (the
checkcommand prints both); - for a new language, a screenshot of QElectroTech in that language, if you could build it.
If you could not build QElectroTech or make the code changes for a new language, say so in the description. A maintainer can add them. Without them the language cannot be chosen, as happened with #1679.
Keep the description short: Posting with an AI assistant.
| Mistake | Result |
|---|---|
New .ts file only, no TS_FILES line or Settings entry |
Merged, but the language never appears |
.qm file committed |
Asked to remove it |
| Translation made from an old copy of the source | Missing strings; merge master and run lupdate again |
| XML edited by the AI directly | Broken file, lost plural forms or entities. Route 2 avoids this |
| Everything marked finished without being read | Wrong words reach every user, and nobody knows which strings to check |
| A new empty file written by hand or by the AI | Wrong number of plural forms; create it with lupdate |
- Languages: changing the interface language, and the state of each translation
- Fix or add with an AI assistant: installing the tools and building QElectroTech
- Posting with an AI assistant: writing the pull request
- Qt Linguist manual
Getting Started
π Languages β English Β· FranΓ§ais Β· Deutsch
Windows without admin rights β the portable archive, no installer
Guides
Conductors β wire properties, what feeds which export, cables, and hops where wires cross
Wires per terminal β limit the wires on a terminal, chain wiring instead of stars
Printing and exporting β paper, PDF, images, and what each path does differently
Linking elements β master, slave, terminal
PLC modules β I/O tables and linking a wire to a specific point
Using the element editor β drawing tools, saving, checks
Generic devices β a quick box symbol with terminals on any side, made by a wizard
Grid size and element size β why symbols aren't all the same scale, and scaling one without leaving the grid
Preferences reference β what each settings page does
Saving and loading settings β your whole setup in one file, to copy or keep
Keyboard-only control β mouseless QET, and what still needs a mouse
Mouse modifiers β what Shift, Ctrl and Alt change while you drag
3D mouse β SpaceMouse pan, zoom and buttons
Aligning items β snap symbols back to the grid, or line them up
Drawing aids β dark mode, snap and grid step, crosshair, dimensions, the tape measure
Symbols already on the sheet β select the same symbols, replace them, show a T-junction as a dot, update placed copies from the collections
Symbol texts β place the texts at nine points, fixed or free size, format painter, title block cells, GOST ESKD, %T
Wiring tools β automatic connections, the Connections toolbar, chained folio reports, a cable across wires
Symbols and parts β edit several symbols, relay contact display, grouped parts list
Device types β what a device is made of: check, place and change its parts, Device Navigator
Project languages and checks β languages in a project, cell origin, duplicate labels, the Check panel
Reports and lists β project lists to CSV/PDF, tables on a folio, label-printer export, symbol list
Pictures on a sheet β labels, crop, transparency, what they cost in the file
Arcs and curved wires β the Arc tool, pulling an arc in or out, rounding a corner with a fillet, dashed arcs for lighting layouts
Grouping items β select, move and copy several items as one
Finding your place on a sheet β go to a cell like B13 or 4-B7, keep the headers in sight, show the cell limits, zoom and pan
Showing and hiding kinds of items β hide texts, wire numbers, shapes, pictures, tables or cross-references on every sheet
Drawing faster β place without dragging, the S shortcut bar, command search, gestures
Customising QElectroTech β keys, toolbar size and contents, the gesture ring
Managing collections β folders, writability, building your own shortlist
Templates β reusable multi-element blocks, placed by double-click or drag
Search & Replace β bulk property changes
Building a nomenclature query β the BOM/summary table builder
Formula columns β build a calculated column in a parts list without writing SQL
Linking wires across pages β sheet reports
Variables & formulas β %f, %{label}, sequences
Auto-numbering β schemes, sequences, freezing
Terminal strips β strips, levels, bridges
Connectors β plugs and sockets as terminal strips or head-with-pins devices, device types, pin check, spare-pin plans
Title block templates β the .titleblock format
Title block alignment β place a title block inside or outside the sheet, left, centred or right
Plants and locations β list, rename, copy a plant, suggestions
Designations and structure boxes β IEC 81346 names, structure boxes, ==/++ levels, folio groups, company prefixes
Revisions, document kinds and drawing standard β revision list and table, IEC 61355 document kind, project standard
Importing EPLAN parts (.edz) β EPLAN Data Portal
DXF import & export β two unrelated features, one format; command-line export and layers
Project files β .qetz (zipped, the default) and .qet, what is inside, opening big projects faster, starting from a template
The one-file project, .qetdb β history of saves, repair, --query over many projects
Saving safely β previous versions, a project open elsewhere, damaged files, crash recovery
The project database β the working SQLite database built when a project opens
Development
Code style β the QET house style for C++, and formatting only the lines you change
Fix or add with an AI assistant β beginner build setup and a prompt that does the work
Check your change: qet-verify β run it before every pull request
Posting with an AI assistant β short, plain pull requests and replies
Translate with an AI assistant β draft the interface in your language, check it, send it
Making a how-to video β a short feature video from a checked story
Writing wiki pages with an AI assistant β the rules, and a checker to run before you push
Automating QET β CLI, XML formats, external tools
CLI Reference β command line usage
JavaScript Scripting β --run, geometry editing, undo
MCP server β let an AI assistant read, verify and edit projects
Connecting an AI assistant β setup for Claude, Copilot, Gemini, Codex, Cursor, LM Studio
Script buttons β stored scripts with an icon, by hand or by an assistant
Live mode β an assistant working in the open project while you watch
Macro recorder β record a task by hand, for an assistant to script
Vision β proposal, under discussion
