Reworded to explain usage of new tool, and to add update instructions for Linux.

TzakShrike 2020-09-13 02:35:30 +09:00
parent a4ff274351
commit 7e74090d95
1 changed files with 18 additions and 9 deletions

@ -1,17 +1,26 @@
This page describes the process for creating and keeping a new translation up to date.
To create a new translation:
To create a new translation (Windows):
1. Clone the repository in the same way as described in the main README (submodules/recursive clone if on Windows).
2. Edit the file named `update_translations.bat` in `src\duckstation-qt` by copying/pasting one of the existing lines, and changing the language code at the end. 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 multiple 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). The file name should follow the `appname_language[_country].ts` convention specified [here](https://doc.qt.io/qt-5/linguist-translators.html#changing-the-target-locale).
3. Run this batch file by double-clicking it. If you're on Linux, this won't work, so you should run `cd src/duckstation-qt` and `lupdate ./ -ts translations/duckstation-qt_LANGUAGE_CODE_HERE.ts` manually instead.
4. This should create a new `.ts` file for your language in the `translations` directory.
5. Open this new translation file in Qt Linguist. If you're on Linux, your package manager will provide it. If you're on Windows, a copy can be found in `dep\msvc\qt\5.15.0\msvc2017_64\bin\linguist.exe`.
6. If prompted, select your language and country. Leave the source language as POSIX.
2. Run `set-language.bat` in `src\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)).
3. Run `update-and-edit-language`, also in `src\duckstation-qt\translations`. This should create a new `.ts` file for your language in the `translations` directory, update it, and open the translation file in Qt Linguist.
4. If prompted, select your language and country. Leave the source language as POSIX. Some languages seem to add a country code where is isn't necessary, too, so check that under Edit > Translation File Settings...
To update an existing translation:
To update an existing translation (Windows):
1. Update your Git repository by running `git pull`. If it gives you an error about local changes, run `git reset --hard` and `git clean -d -f -x` to clear them out, and run `git pull` again. 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.
2. Run the `update_translations.bat` file first used to create the translation.
3. This will add the new strings to the `.ts` file and report how many new strings there are for translation, which you can open in Linguist and quickly jump to.
2. Run the `update-and-edit-language.bat` file in `src\duckstation-qt\translations`. This will add the new strings to the `.ts` file and report how many new strings there are for translation, and open it in Qt Linguist for editing.
To create a new translation (Linux):
1. Clone the repository in the same way as described in the main README.
2. run `cd src/duckstation-qt` and `lupdate ./ -ts translations/duckstation-qt_LANGUAGE_CODE_HERE.ts` manually. The file name should follow the `appname_language[_country].ts` convention specified [here](https://doc.qt.io/qt-5/linguist-translators.html#changing-the-target-locale). This should create a new `.ts` file for your language in the `translations` directory. 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).
3. Open this new translation file in Qt Linguist. On Linux, your package manager will provide it.
4. If prompted, select your language and country. Leave the source language as POSIX. Some languages seem to add a country code where is isn't necessary, too, so check that under Edit > Translation File Settings...
To update an existing translation (Linux):
1. Update your Git repository by running `git pull`. If it gives you an error about local changes, run `git reset --hard` and `git clean -d -f -x` to clear them out, and run `git pull` again. 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.
2. run `cd src/duckstation-qt` and `lupdate ./ -ts translations/duckstation-qt_LANGUAGE_CODE_HERE.ts` manually. This will add the new strings to the `.ts` file and report how many new strings there are for translation.
3. Open the translation file in Qt Linguist.
Translating strings:
1. 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.