mirror of
https://github.com/stenzek/duckstation.git
synced 2025-11-23 06:59:30 +00:00
Page:
Translating to new languages
No results
10
Translating to new languages
Connor McLaughlin edited this page 2023-09-27 22:07:45 +10:00
This page describes the process for creating and keeping a new translation up to date.
Windows
Qt Dependencies Setup
- Download
deps-x64.7zfrom https://github.com/stenzek/duckstation-ext-qt-minimal/releases/tag/latest. - Extract to the
dep\msvcdirectory. - Verify you have
lupdate.exein the following path (replaceD:\Projects\duckstationwith your clone path):D:\Projects\duckstation\dep\msvc\deps-x64\bin.
Create 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\translations.- You can find a list of language codes here: 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 at the end after an underscore. You can find a list of country codes here: https://en.wikipedia.org/wiki/List_of_ISO_3166_country_codes (use the 3166-1 Alpha-2 code).
- Follow the on-screen instructions.
- This should create a new
.tsfile for your language in thetranslationsdirectory, update it, and open the translation file in Qt Linguist.
- This should create a new
- Leave the source language as POSIX. Some languages seem to add a country code where it isn't necessary, too, so check that under Edit > Translation File Settings...
Update Existing Translation
- Update your Git repository by running
git pull. If it gives you an error about local changes, rungit reset --hardandgit clean -d -f -xto clear them out, and rungit pullagain. But make sure you have nothing you want to save in the repo first, I won't take responsibility if you delete your work this way. - Drag and drop the
.tsfile you wish to edit ontocreate-update-and-edit-language.batfile insrc\duckstation-qt\translations.- This will add the new strings to the
.tsfile, report how many new strings there are for translation, and open it in Qt Linguist for editing.
- This will add the new strings to the
Linux
Create New Translation
- Clone the repository in the same way as described in the main README (submodules/recursive clone).
- Run
cd src/duckstation-qtandlupdate ./ ../core/ ../util/ -tr-function-alias QT_TRANSLATE_NOOP+=TRANSLATE,QT_TRANSLATE_NOOP+=TRANSLATE_SV,QT_TRANSLATE_NOOP+=TRANSLATE_STR,QT_TRANSLATE_NOOP+=TRANSLATE_FS,QT_TRANSLATE_N_NOOP3+=TRANSLATE_FMT,QT_TRANSLATE_NOOP+=TRANSLATE_NOOP -ts translations/duckstation-qt_LANGUAGE_CODE_HERE.tsmanually. The file name should follow theappname_language[_country].tsconvention specified here.- This should create a new
.tsfile for your language in thetranslationsdirectory. - You can find a list of language codes here: 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 at the end after an underscore. You can find a list of country codes here: https://en.wikipedia.org/wiki/List_of_ISO_3166_country_codes (use the 3166-1 Alpha-2 code).
- This should create a new
- Open this new translation file in Qt Linguist. On Linux, your package manager will provide it.
- If prompted, select your language and country. Leave the source language as POSIX. Some languages seem to add a country code where it isn't necessary, too, so check that under Edit > Translation File Settings...
Update Existing Translation
- Update your Git repository by running
git pull. If it gives you an error about local changes, rungit reset --hardandgit clean -d -f -xto clear them out, and rungit pullagain. But make sure you have nothing you want to save in the repo first, I won't take responsibility if you delete your work this way. - Run
cd src/duckstation-qtandlupdate ./ ../core/ ../util/ -tr-function-alias QT_TRANSLATE_NOOP+=TRANSLATE,QT_TRANSLATE_NOOP+=TRANSLATE_SV,QT_TRANSLATE_NOOP+=TRANSLATE_STR,QT_TRANSLATE_NOOP+=TRANSLATE_FS,QT_TRANSLATE_N_NOOP3+=TRANSLATE_FMT,QT_TRANSLATE_NOOP+=TRANSLATE_NOOP -ts translations/duckstation-qt_LANGUAGE_CODE_HERE.tsmanually.- This will add the new strings to the
.tsfile and report how many new strings there are for translation.
- This will add the new strings to the
- Open the translation file in Qt Linguist.
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, this way when new strings are added you can jump directly to them.
- To submit your translation or updates, follow the normal Git process for forking/creating a branch/creating a pull request.
- You only want to submit the changes to your language's
.tsfile, no other files. - If you are unsure about how to do this, send your translation (
.tsfile) directly to Stenzek or to a member of the Translators team on Discord, and it will be committed/pushed for you.
- You only want to submit the changes to your language's
Additional Info
- Refer to the Qt reference manual here: https://doc.qt.io/qt-5/linguist-translators.html
- We also have a
#translationchannel on Discord where questions can be asked/you can get clarification on technical terms.