Skip to content

Commit 33f36d8

Browse files
committed
Improve theme translations documentation
1 parent aec1dd0 commit 33f36d8

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

src/topics/Translations.md

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ Then, to localize a theme:
3636

3737
1. In `QGIS → Project Properties → General`, generate a project translation file by selecting the source language and pressing `Generate TS File`.
3838
2. Rename the generated `<projectname>.ts` to `<projectname>_<lang>.ts`, where `<lang>` is language code like `de` or `de-CH`.
39-
3. Open the `<projectname>_<lang>.ts` with the `Qt Linguist` application and fill out the translations. Note that translations need to be marked as "finished" in Qt Linguist
39+
3. Open the `<projectname>_<lang>.ts` with the `Qt Linguist` application and fill out the translations. Note that translations need to be marked as "finished" in Qt Linguist.
4040

4141
Since the QGIS project translations mechanism does not currently allow translating some project strings which are useful for QWC, these need to be defined in an auxiliary translation file `<projectname>_<lang>.json` structured as follows:
4242
```json
@@ -45,6 +45,13 @@ Since the QGIS project translations mechanism does not currently allow translati
4545
"<layer_name>": "<translated_layer_name>",
4646
...
4747
},
48+
"layers": {
49+
"<layer_name>": {
50+
"fields": {
51+
"<field_name>": "<translated_field_name>"
52+
}
53+
}
54+
},
4855
"layouts": {
4956
"<layout_name>": "<translated_layout_name>",
5057
...
@@ -57,10 +64,13 @@ Since the QGIS project translations mechanism does not currently allow translati
5764

5865
Where:
5966

60-
- `layertree` is used to translated layer/group names. Most layer names can be translated via `.ts` files, but for instance group names of embedded projects are currently not handled by QGIS.
67+
- `layertree` is used to translated layer/group names. Most layer names can be translated via `.ts` files, but for instance group names of embedded projects are currently not handled by QGIS. Note that `<layer_name>` is a technical layer name (or short name, if set), not a layer title.
68+
- `layers` is used to translate layer attributes, where `<layer_name>` is again a technical layer name, and `<filed_name>` a technical field name (i.e. not alias).
6169
- `layouts` is used to translate print layout names. Note that if you want to translate the name of a (print layout templates)[Printing.md#layout-templates], the `layout_name` may need to include the path portion of the layout (i.e. `<subdir>/<layout_name>`).
6270
- `theme` is used to translate the theme title (and possibly other strings in the future)
6371

72+
*Note*: You can also manage all string translations in the auxiliary `json` file and avoid using the `.ts` based mechanism.
73+
6474
Finally, run the `ConfigGenerator` to include the translated theme names in the themes configuration.
6575

6676
You can specify common translations which will be applied to all themes by adding a `maptranslations` block to the viewer translations (see below) in the form

0 commit comments

Comments
 (0)