Skip to content

Commit 582c096

Browse files
committed
Document common maptranslations
1 parent 173641f commit 582c096

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

src/topics/Translations.md

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,10 @@ Then, to localize a theme:
2929
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:
3030
```json
3131
{
32+
"layertree": {
33+
"<layer_name>": "<translated_layer_name>",
34+
...
35+
},
3236
"layouts": {
3337
"<layout_name>": "<translated_layout_name>",
3438
...
@@ -41,11 +45,31 @@ Since the QGIS project translations mechanism does not currently allow translati
4145

4246
Where:
4347

48+
- `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.
4449
- `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>`).
4550
- `theme` is used to translate the theme title (and possibly other strings in the future)
4651

4752
Finally, run the `ConfigGenerator` to include the translated theme names in the themes configuration.
4853

54+
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
55+
```
56+
{
57+
"messages": {
58+
"maptranslations": {
59+
"layertree": {
60+
"<layer_name>": "<translated_layer_name>",
61+
...
62+
},
63+
"layouts": {
64+
"<layout_name>": "<translated_layout_name>",
65+
...
66+
}
67+
}
68+
}
69+
}
70+
```
71+
72+
In particular, these common translations can be specified in a `<lang>_overrides.json` file, see below.
4973

5074
### Localized viewer asssets
5175

0 commit comments

Comments
 (0)