@@ -9,18 +9,24 @@ QtMvvm::ISettingsSetupLoader. The files are read via that service and mapped to
9
9
QtMvvm::SettingsElements::Setup.
10
10
11
11
@section settings_xml_translator Translations
12
- All the settings files you have can be easily translated via a standard ts/qm file. In order for
13
- this to work, all you have to do is add the following lines to your pro file:
12
+ All the settings files you have can be easily translated via a standard ts/qm file. The following
13
+ explains how exactly.
14
+
15
+ The mvvm core module comes with a special make taget, called `lupdate` that will automatically
16
+ run lupdate when your sources change to update the TRANSLATIONS files. To not run this automatically,
17
+ call qmake with `qmake CONFIG+=no_auto_lupdate ...`. In both cases, you can always run `make lupdate`
18
+ to explicitly update the dependencies.
19
+
20
+ With this step enabled, the only thing left to do is to add the settings xml file to the translation
21
+ targets so it gets included as a source when running the lupdate target. To do so, simply add it
22
+ to the `SETTINGS_TRANSLATIONS` qmake variable:
14
23
15
24
@code{.pro}
16
- QTMVVM_TS_SETTINGS += settings.xml
17
- _never_true_condition: SOURCES += $$files($$PWD/.ts-dummy/*)
18
- PRE_TARGETDEPS += qtmvvm-tsgen #optional
25
+ SETTINGS_TRANSLATIONS += settings.xml
19
26
@endcode
20
27
21
- This will automatically generate a dummy cpp file in the `.ts-dummy` folder for each file
22
- added to the `QTMVVM_TS_SETTINGS` variable. These files contain dummy code that will then be
23
- read by lupdate automatically and added to all your ts files.
28
+ This will internally generate a cpp file that is parsed and included in lupdate when running it
29
+ via the builtin lupdate target.
24
30
25
31
@section settings_xml_elements Elements
26
32
The possible elements of such a file
@@ -162,6 +168,7 @@ long as for the last two their type is `object`
162
168
key | string | <i>Required</i> | no | The key of the property
163
169
type | @ref settings_xml_types_type | <i>Required</i> | no | The type of the properties value
164
170
tr | bool | `false` | no | Specify whether the properties value (content) should be translated. Does not apply to `list` or `object` types
171
+ ztr | bool | `false` | no | Like tr, but does not translate the text, only generate the translation in the ts file
165
172
166
173
167
174
@subsubsection settings_xml_elements_property_elements Content
@@ -185,6 +192,7 @@ same.
185
192
--------|-------------------------------|-------------------|---------------|-------------
186
193
type | @ref settings_xml_types_type | <i>Required</i> | no | The type of the list element
187
194
tr | bool | `false` | no | Specify whether the element value (content) should be translated. Does not apply to `list` or `object` types
195
+ ztr | bool | `false` | no | Like tr, but does not translate the text, only generate the translation in the ts file
188
196
189
197
@subsubsection settings_xml_elements_element_elements Content
190
198
The content depend on the `type` attribute. The following tables shows which type leads
@@ -206,9 +214,11 @@ element must be a `<Group>` element (Each element that support includes as one c
206
214
marked as primary). It is possible to specify an include element in another included document.
207
215
208
216
@subsubsection settings_xml_elements_include_attribs Attributes
209
- Name | Type | Default | Translated | Description
210
- ------------|-------|-----------|---------------|-------------
211
- optional | bool | `false` | no | An optional include. If the file cannot be found it is skipped instead of aborting with an error
217
+ Name | Type | Default | Translated | Description
218
+ ------------|---------------------------------------|---------------|---------------|-------------
219
+ optional | bool | `false` | no | An optional include. If the file cannot be found it is skipped instead of aborting with an error
220
+ frontends | @ref settings_xml_types_descriptor | <i>Empty</i> | no | @copybrief QtMvvm::SettingsElements::Entry::frontends
221
+ selectors | @ref settings_xml_types_descriptor | <i>Empty</i> | no | @copybrief QtMvvm::SettingsElements::Entry::selectors
212
222
213
223
@subsubsection settings_xml_elements_include_elements Content
214
224
The content of the include element must be a path to an XML file to be read as include. If the
@@ -300,4 +310,10 @@ The following code block is a sample settings XML file. It is the same that is b
300
310
the example application.
301
311
302
312
@include settings.xml
313
+
314
+ @section settings_xml_xsd The XSD for the settings files
315
+ The following file is the XSD the parser operates on. You can use it to verify your settings
316
+ xml files.
317
+
318
+ @include settingsconfig.xsd
303
319
*/
0 commit comments