@@ -9,18 +9,24 @@ QtMvvm::ISettingsSetupLoader. The files are read via that service and mapped to
99QtMvvm::SettingsElements::Setup.
1010
1111@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:
1423
1524@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
1926@endcode
2027
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.
2430
2531@section settings_xml_elements Elements
2632The possible elements of such a file
@@ -162,6 +168,7 @@ long as for the last two their type is `object`
162168 key | string | <i>Required</i> | no | The key of the property
163169 type | @ref settings_xml_types_type | <i>Required</i> | no | The type of the properties value
164170 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
165172
166173
167174@subsubsection settings_xml_elements_property_elements Content
@@ -185,6 +192,7 @@ same.
185192--------|-------------------------------|-------------------|---------------|-------------
186193 type | @ref settings_xml_types_type | <i>Required</i> | no | The type of the list element
187194 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
188196
189197@subsubsection settings_xml_elements_element_elements Content
190198The 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
206214marked as primary). It is possible to specify an include element in another included document.
207215
208216@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
212222
213223@subsubsection settings_xml_elements_include_elements Content
214224The 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
300310the example application.
301311
302312@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
303319*/
0 commit comments