Update the i18n readme

This commit is contained in:
Veronica K. B. Olsen
2021-02-18 21:42:46 +01:00
parent d4e0bacde9
commit f74d575d6a
2 changed files with 27 additions and 20 deletions
+25 -19
View File
@@ -1,18 +1,21 @@
# novelWriter Internationalisation # novelWriter Internationalisation
The `i18n` folder contains the internationalisation files for novelWriter. The `i18n` folder contains the internationalisation files for novelWriter.
There are two types of files. The `nw_XX.qm` files are for localisation of the There are two types of files. The `nw_XX.ts` / `nw_XX.qm` files are for
main GUI, and the `project_XX.json` files are JSON files with translation maps localisation of the main GUI, and the `project_XX.json` files are JSON files
for the novelWriter projects. with translation maps for the novelWriter projects, used by the Build Novel
Project tool.
## GUI Localisation ## GUI Localisation
The `.qm` files are not generated by default. They can be built with: The `.qm` files are the actual files used by the application to translate the
GUI into another language other than the default British English. The files are
not generated by default. They can be built with:
```bash ```bash
python3 setup.py qtlrelease python3 setup.py qtlrelease
``` ```
To add a new translation file, please add a new entry in the `novelWriter.pro` To add a new translation file, first add a new entry in the `novelWriter.pro`
file under the `TRANSLATIONS` variable. Please use the underscore syntax for file under the `TRANSLATIONS` variable. Please use the underscore syntax for
file names as the importer expects this format. file names as the importer expects this format.
@@ -22,11 +25,16 @@ python3 setup.py qtlupdate
``` ```
This will build a new `nw_XX.ts` file for the language you just added. The file This will build a new `nw_XX.ts` file for the language you just added. The file
can then be edited with the Qt 5 Linguist application. Please select "English" can then be edited with the Qt 5 Linguist application provided by Qt. This is
and "United Kingdom" as the source langauge when prompted. by far easier than manually editing the `.ts` file. Please select "English" and
"United Kingdom" as the source langauge when prompted by Qt 5 Linguist.
When you're done editing, you can build the `nw_XX.qm` file and test it in When you're done editing, you can build the `nw_XX.qm` file and test it in
novelWriter. novelWriter. The Preferences dialog should list the newly added language, and
you can select it and test it.
Please do not submit thw `.qm` files to the repository. Only the `.ts` files
are needed.
**Note:** This requires that you have the tools Qt 5 Linguist and `pylupdate5` **Note:** This requires that you have the tools Qt 5 Linguist and `pylupdate5`
installed on your system. installed on your system.
@@ -37,16 +45,14 @@ Projects can have a different language setting than the GUI itself. The files
with format `project_XX.json` are simple translation maps for text that goes with format `project_XX.json` are simple translation maps for text that goes
into the exported documents. into the exported documents.
The files are loaded based on the main GUI spell check language or the The files are loaded based on the language setting on the Build Novel Project
project's spell check language. The project's spell check language takes tool. At the present time, no other parts of the application use these files.
precedence over the GUI spell check language. Since these are used as replacement lookups, they are maintained as plain JSON
files. The main usage is to generate chapter headers as number words.
Since these are used mainly as replacement lookups, they are maintained as
plain JSON files. The main usage is to generate chapter headers as number
words.
There is no trick to using these files. Just copy the `project_en.json` file, There is no trick to using these files. Just copy the `project_en.json` file,
rename it, and edit it. Please use the underscore as separator if a language rename it to the appropriate language coded filename, and edit it. Please use
needs to be localised to a specific country under a language. The importer will the underscore as separator if a language needs to be localised to a specific
for instance look for `en_GB` or `en_US` first, then use `en` if either is not country under a language. The importer will for instance look for `en_US`
found. If there are no matching files, the project falls back to using English. first, then use `en` if it is not found. If there are no matching files, the
project falls back to using English.
+2 -1
View File
@@ -1,5 +1,6 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE TS><TS version="2.0" language="pt" sourcelanguage="en"> <!DOCTYPE TS>
<TS version="2.1" language="pt" sourcelanguage="en_GB">
<context> <context>
<name>Common</name> <name>Common</name>
<message> <message>