This page describes the process for creating and keeping a translation up to date.
Translation Workflow
Updating a translation is a two-step process:
- Run the create/update script to extract new strings and open the catalog in Qt Linguist. As part of this extraction,
lupdateadds source location information. - After saving and closing Qt Linguist, run the cleanup script on the
.tsfile. Cleanup removes obsolete strings and source location information so the catalog is ready for a pull request.
Translation CI enforces this cleanup for every changed catalog. A pull request will fail validation if its .ts file contains obsolete or vanished strings, or any <location> information. Removing the location information before submission avoids the large amount of unrelated line churn that source file changes would otherwise create.
Windows
Qt Dependencies Setup
- Clone the repository.
- Download the dependencies pack from https://github.com/duckstation/dependencies. You'll need the
deps-windows-x64.7zfile. Extract it todep\prebuilt. - Verify you have
lupdate.exein the following path (replaceD:\Projects\duckstationwith your clone path):D:\Projects\duckstation\dep\prebuilt\windows-x64\bin.
Create a New Translation
- Clone the repository in the same way as described in the main README (submodules/recursive clone).
- Run
create-update-and-edit-language.batinsrc\duckstation-qt\translationsand follow the on-screen instructions.- You can find a list of language codes at https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes (use the 639-1 code).
- If your language has different variants for different countries, append a two-letter country code. You can find a list of country codes at https://en.wikipedia.org/wiki/List_of_ISO_3166_country_codes (use the 3166-1 Alpha-2 code).
- The script creates the
.tsfile, adds the current strings, and opens it in Qt Linguist.
- Leave the source language as POSIX. Some languages add an unnecessary country code, so also check Edit > Translation File Settings.
- Translate the catalog, save it, and close Qt Linguist.
- Drag the new
.tsfile ontocleanup-translation.bat.- When cleanup succeeds, it reports that the file is ready for a pull request and pauses so you can read the result.
Update an Existing Translation
- Update your Git repository by running
git pull. If it reports local changes, preserve any work you need before cleaning or resetting the repository. - Drag the
.tsfile you wish to edit ontocreate-update-and-edit-language.batinsrc\duckstation-qt\translations.- The script adds new strings, reports how many were found, and opens the catalog in Qt Linguist.
- Translate the new strings, save the catalog, and close Qt Linguist.
- Drag the
.tsfile ontocleanup-translation.batbefore creating your pull request.
Update the English Catalog
Run update-and-edit-english.bat in src\duckstation-qt\translations. The English update script always removes obsolete strings and omits location information, so a separate cleanup pass is not required.
Linux
The Linux scripts use the bundled tools in dep/prebuilt/linux-x64/bin. Run them from src/duckstation-qt/translations.
Create a New Translation
-
Clone the repository in the same way as described in the main README.
-
Change to the translations directory:
cd src/duckstation-qt/translations -
Run the create/update script and follow the on-screen instructions:
./create-update-and-edit-language.sh- You can find a list of language codes at https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes (use the 639-1 code).
- If your language has different variants for different countries, append a two-letter country code. You can find a list of country codes at https://en.wikipedia.org/wiki/List_of_ISO_3166_country_codes (use the 3166-1 Alpha-2 code).
- The script creates the
.tsfile, adds the current strings, and opens it in Qt Linguist.
-
Leave the source language as POSIX. Some languages add an unnecessary country code, so also check Edit > Translation File Settings.
-
Translate the catalog, save it, and close Qt Linguist.
-
Run cleanup, replacing the example filename with your catalog:
./cleanup-translation.sh duckstation-qt_LANGUAGE_CODE.tsWhen cleanup succeeds, it reports that the file is ready for a pull request.
Update an Existing Translation
-
Update your Git repository by running
git pull. If it reports local changes, preserve any work you need before cleaning or resetting the repository. -
Change to
src/duckstation-qt/translationsand pass the catalog to the create/update script:./create-update-and-edit-language.sh duckstation-qt_LANGUAGE_CODE.tsThe script adds new strings, reports how many were found, and opens the catalog in Qt Linguist.
-
Translate the new strings, save the catalog, and close Qt Linguist.
-
Clean the catalog before creating your pull request:
./cleanup-translation.sh duckstation-qt_LANGUAGE_CODE.ts
Update the English Catalog
Run the English helper from src/duckstation-qt/translations:
./update-and-edit-english.sh
The English update script always removes obsolete strings and omits location information, so a separate cleanup pass is not required.
Translating Strings
- For each form/context on the left, a list of strings will appear in the middle for translation. A mock version of the UI will also be displayed.
- Go through each string, entering a translation in your target language in the text box below. Mark the string as Completed (check mark) after doing so, so that when new strings are added you can jump directly to them.
- Run the platform-specific cleanup script after editing.
- To submit your translation or updates, follow the normal Git process for forking, creating a branch, and creating a pull request.
- You only want to submit the changes to your language's
.tsfile, with no other files. - If you are unsure how to do this, send your translation (
.tsfile) directly to Stenzek or a member of the Translators team on Discord, and it will be committed and pushed for you.
- You only want to submit the changes to your language's
Additional Info
- Refer to the Qt reference manual at https://doc.qt.io/qt-5/linguist-translators.html.
- We also have a
#translationchannel on Discord where questions can be asked and technical terms clarified.