Skip to content
This repository was archived by the owner on Mar 4, 2023. It is now read-only.

Commit b613946

Browse files
committed
fix translator stuff
1 parent 06fe2b6 commit b613946

File tree

8 files changed

+104
-518
lines changed

8 files changed

+104
-518
lines changed

examples/mvvmcore/SampleCore/SampleCore.pro

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,7 @@ SOURCES += \
2727
RESOURCES += \
2828
sample_core.qrc
2929

30-
QTMVVM_TS_SETTINGS += settings.xml
31-
_never_true_condition: SOURCES += $$files($$PWD/.ts-dummy/*)
30+
SETTINGS_TRANSLATIONS += settings.xml
3231

3332
TRANSLATIONS += samplecore_de.ts
3433
DISTFILES += $$TRANSLATIONS

examples/mvvmcore/SampleCore/samplecore_de.ts

Lines changed: 80 additions & 86 deletions
Original file line numberDiff line numberDiff line change
@@ -104,42 +104,34 @@
104104
</message>
105105
</context>
106106
<context>
107-
<name>qtmvvm_settings_xml</name>
107+
<name>settings.xml</name>
108108
<message>
109-
<location filename=".ts-dummy/settings.tsdummy.cpp" line="+17"/>
110-
<location line="+11"/>
111-
<location line="+12"/>
112-
<source>Select a &amp;mode</source>
113-
<translation type="unfinished"></translation>
114-
</message>
115-
<message>
116-
<location line="-22"/>
117-
<location line="+2"/>
118-
<source>Variant B</source>
109+
<location filename="../../../../build-qtmvvm-Desktop_Qt_5_11_1_GCC_64bit-Debug/examples/mvvmcore/SampleCore/.tr-dummies/settings.tsdummy.cpp" line="+7"/>
110+
<source>&amp;Check me</source>
119111
<translation type="unfinished"></translation>
120112
</message>
121113
<message>
122-
<location line="+4"/>
123-
<source>This is another section</source>
114+
<location line="+1"/>
115+
<source>I am a checkbox!</source>
124116
<translation type="unfinished"></translation>
125117
</message>
126118
<message>
127-
<location line="-3"/>
128-
<source>Variant C</source>
119+
<location line="+1"/>
120+
<source>property</source>
129121
<translation type="unfinished"></translation>
130122
</message>
131123
<message>
132-
<location line="+24"/>
133-
<source>https://example.org/test</source>
124+
<location line="+1"/>
125+
<source>bool</source>
134126
<translation type="unfinished"></translation>
135127
</message>
136128
<message>
137-
<location line="-14"/>
138-
<source>Value C</source>
129+
<location line="+1"/>
130+
<source>Enter a &amp;name</source>
139131
<translation type="unfinished"></translation>
140132
</message>
141133
<message>
142-
<location line="-21"/>
134+
<location line="+1"/>
143135
<source>Enter a nice name</source>
144136
<translation type="unfinished"></translation>
145137
</message>
@@ -149,181 +141,183 @@
149141
<translation type="unfinished"></translation>
150142
</message>
151143
<message>
152-
<location line="+4"/>
153-
<source>Pressing this action will open the system settings</source>
144+
<location line="+1"/>
145+
<source>Sub-Group</source>
154146
<translation type="unfinished"></translation>
155147
</message>
156148
<message>
157-
<location line="+7"/>
158-
<location line="+14"/>
159-
<source>Current value: %1</source>
149+
<location line="+1"/>
150+
<source>This is a tooltip</source>
160151
<translation type="unfinished"></translation>
161152
</message>
162153
<message>
163-
<location line="-9"/>
164-
<source>Current value: %L1</source>
154+
<location line="+1"/>
155+
<source>Open &amp;system settings</source>
165156
<translation type="unfinished"></translation>
166157
</message>
167158
<message>
168-
<location line="+5"/>
169-
<source>Value A+B</source>
159+
<location line="+1"/>
160+
<source>Pressing this action will open the system settings</source>
170161
<translation type="unfinished"></translation>
171162
</message>
172163
<message>
173-
<location line="+3"/>
174-
<source>Value A+B+C</source>
164+
<location line="+1"/>
165+
<source>You can use this to trigger whatever kind of action you need</source>
175166
<translation type="unfinished"></translation>
176167
</message>
177168
<message>
178-
<location line="-28"/>
179-
<source>bool</source>
169+
<location line="+1"/>
170+
<source>Select a &amp;mode</source>
180171
<translation type="unfinished"></translation>
181172
</message>
182173
<message>
183-
<location line="+7"/>
184-
<source>Open &amp;system settings</source>
174+
<location line="+1"/>
175+
<source>Variant B</source>
185176
<translation type="unfinished"></translation>
186177
</message>
187178
<message>
188-
<location line="+19"/>
189-
<source>Value A+C</source>
179+
<location line="+1"/>
180+
<source>Variant A</source>
190181
<translation type="unfinished"></translation>
191182
</message>
192183
<message>
193-
<location line="-29"/>
194-
<source>&amp;Check me</source>
184+
<location line="+1"/>
185+
<source>Variant C</source>
195186
<translation type="unfinished"></translation>
196187
</message>
197188
<message>
198-
<location line="+2"/>
199-
<location line="+3"/>
200-
<source>property</source>
189+
<location line="+1"/>
190+
<source>Current value: %1</source>
201191
<translation type="unfinished"></translation>
202192
</message>
203193
<message>
204-
<location line="+14"/>
194+
<location line="+1"/>
205195
<source>Another Section</source>
206196
<translation type="unfinished"></translation>
207197
</message>
208198
<message>
209-
<location line="+16"/>
210-
<source>Is set to %n unit(s)</source>
199+
<location line="+1"/>
200+
<source>This is another section</source>
211201
<translation type="unfinished"></translation>
212202
</message>
213203
<message>
214-
<location line="+5"/>
215-
<source>Enter a &amp;website</source>
204+
<location line="+1"/>
205+
<source>Enter a &amp;value</source>
216206
<translation type="unfinished"></translation>
217207
</message>
218208
<message>
219-
<location line="-7"/>
220-
<source>Another main category</source>
209+
<location line="+1"/>
210+
<source>The value must be between 0 and 1</source>
221211
<translation type="unfinished"></translation>
222212
</message>
223213
<message>
224-
<location line="+4"/>
225-
<location line="+2"/>
226-
<source>Text 2</source>
214+
<location line="+1"/>
215+
<source>Current value: %L1</source>
227216
<translation type="unfinished"></translation>
228217
</message>
229218
<message>
230-
<location line="-30"/>
231-
<source>This is a tooltip</source>
219+
<location line="+1"/>
220+
<source>Value A</source>
232221
<translation type="unfinished"></translation>
233222
</message>
234223
<message>
235-
<location line="+12"/>
236-
<source>Enter a &amp;value</source>
224+
<location line="+1"/>
225+
<source>Value B</source>
237226
<translation type="unfinished"></translation>
238227
</message>
239228
<message>
240-
<location line="+21"/>
241-
<source>Choose a &amp;font</source>
229+
<location line="+1"/>
230+
<source>Value C</source>
242231
<translation type="unfinished"></translation>
243232
</message>
244233
<message>
245-
<location line="-27"/>
246-
<source>Variant A</source>
234+
<location line="+1"/>
235+
<source>Value A+B</source>
247236
<translation type="unfinished"></translation>
248237
</message>
249238
<message>
250-
<location line="+10"/>
251-
<source>Value A</source>
239+
<location line="+1"/>
240+
<source>Value A+C</source>
252241
<translation type="unfinished"></translation>
253242
</message>
254243
<message>
255-
<location line="-21"/>
256-
<source>Enter a &amp;name</source>
244+
<location line="+1"/>
245+
<source>Value B+C</source>
257246
<translation type="unfinished"></translation>
258247
</message>
259248
<message>
260-
<location line="-3"/>
261-
<source>I am a checkbox!</source>
249+
<location line="+1"/>
250+
<source>Value A+B+C</source>
251+
<translation type="unfinished"></translation>
252+
</message>
253+
<message>
254+
<location line="+1"/>
255+
<source>Another main category</source>
262256
<translation type="unfinished"></translation>
263257
</message>
264258
<message>
265-
<location line="+33"/>
259+
<location line="+1"/>
266260
<source>Enter a &amp;number</source>
267261
<translation type="unfinished"></translation>
268262
</message>
269263
<message>
270-
<location line="-22"/>
271-
<source>You can use this to trigger whatever kind of action you need</source>
264+
<location line="+1"/>
265+
<source>Is set to %n unit(s)</source>
272266
<translation type="unfinished"></translation>
273267
</message>
274268
<message>
275-
<location line="+14"/>
276-
<source>Value B</source>
269+
<location line="+1"/>
270+
<source>Text 2</source>
277271
<translation type="unfinished"></translation>
278272
</message>
279273
<message>
280-
<location line="-4"/>
281-
<source>The value must be between 0 and 1</source>
274+
<location line="+1"/>
275+
<source>Text 1</source>
282276
<translation type="unfinished"></translation>
283277
</message>
284278
<message>
285-
<location line="+21"/>
286-
<source>&amp;Volume</source>
279+
<location line="+1"/>
280+
<source>Enter a &amp;website</source>
287281
<translation type="unfinished"></translation>
288282
</message>
289283
<message>
290284
<location line="+1"/>
291-
<source>Choose a time</source>
285+
<source>https://example.org/test</source>
292286
<translation type="unfinished"></translation>
293287
</message>
294288
<message>
295289
<location line="+1"/>
296-
<source>Choose a date</source>
290+
<source>Choose a &amp;font</source>
297291
<translation type="unfinished"></translation>
298292
</message>
299293
<message>
300294
<location line="+1"/>
301-
<source>Choose a date and time</source>
295+
<source>&amp;Volume</source>
302296
<translation type="unfinished"></translation>
303297
</message>
304298
<message>
305299
<location line="+1"/>
306-
<source>Choose a color</source>
300+
<source>Choose a time</source>
307301
<translation type="unfinished"></translation>
308302
</message>
309303
<message>
310304
<location line="+1"/>
311-
<source>Non existing type</source>
305+
<source>Choose a date</source>
312306
<translation type="unfinished"></translation>
313307
</message>
314308
<message>
315-
<location line="-10"/>
316-
<source>Text 1</source>
309+
<location line="+1"/>
310+
<source>Choose a date and time</source>
317311
<translation type="unfinished"></translation>
318312
</message>
319313
<message>
320-
<location line="-30"/>
321-
<source>Sub-Group</source>
314+
<location line="+1"/>
315+
<source>Choose a color</source>
322316
<translation type="unfinished"></translation>
323317
</message>
324318
<message>
325-
<location line="+22"/>
326-
<source>Value B+C</source>
319+
<location line="+1"/>
320+
<source>Non existing type</source>
327321
<translation type="unfinished"></translation>
328322
</message>
329323
</context>

mkspecs/features/qsettingstranslator.prf

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ QSETTINGSTRANSLATOR_DIR = $$QSETTINGSTRANSLATOR_DIR$$SUFFIX
1212
!ReleaseBuild: {
1313
qsettingstranslator_c.name = qsettingsgenerator --translate ${QMAKE_FILE_IN}
1414
qsettingstranslator_c.input = SETTINGS_TRANSLATIONS
15-
qsettingstranslator_c.variable_out = CPP_DUMMIES
15+
qsettingstranslator_c.variable_out = CPP_TS_DUMMIES
1616
qsettingstranslator_c.commands = $$QMAKE_QSETTINGSGENERATOR --translate --in ${QMAKE_FILE_IN} --impl ${QMAKE_FILE_OUT}
1717
qsettingstranslator_c.output = $$QSETTINGSTRANSLATOR_DIR/${QMAKE_FILE_BASE}.tsdummy$${first(QMAKE_EXT_CPP)}
1818
qsettingstranslator_c.CONFIG += no_link
@@ -26,8 +26,16 @@ QSETTINGSTRANSLATOR_DIR = $$QSETTINGSTRANSLATOR_DIR$$SUFFIX
2626
else: return($$shell_quote($$1))
2727
}
2828

29+
lupdate_trcond_c.name = lupdate condition ${QMAKE_FILE_IN}
30+
lupdate_trcond_c.input = TRANSLATIONS
31+
lupdate_trcond_c.variable_out = TRANSLATIONS_CONDITION
32+
lupdate_trcond_c.commands = echo created > ${QMAKE_FILE_OUT}
33+
lupdate_trcond_c.output = $$QSETTINGSTRANSLATOR_DIR/trcond.cpp
34+
lupdate_trcond_c.CONFIG += combine no_link
35+
QMAKE_EXTRA_COMPILERS += lupdate_trcond_c
36+
2937
lupdate_fakepri_c.name = fakepri ${QMAKE_FILE_IN}
30-
lupdate_fakepri_c.input = CPP_DUMMIES GENERATED_SOURCES
38+
lupdate_fakepri_c.input = TRANSLATIONS_CONDITION CPP_TS_DUMMIES GENERATED_SOURCES
3139
lupdate_fakepri_c.variable_out = TS_FAKEPRI_FILES
3240
lupdate_fakepri_c.commands = echo $$qmake_escape(BUILD_SOURCES += ${QMAKE_FILE_IN}) > ${QMAKE_FILE_OUT} \
3341
$$escape_expand(\\n\\t)echo $$qmake_escape(for(src, BUILD_SOURCES): SOURCES += $${DBL_DOLLAR}PWD/$${DBL_DOLLAR}src) >> ${QMAKE_FILE_OUT}
@@ -45,13 +53,13 @@ QSETTINGSTRANSLATOR_DIR = $$QSETTINGSTRANSLATOR_DIR$$SUFFIX
4553
QMAKE_EXTRA_COMPILERS += lupdate_fakepro_c
4654

4755
lupdate_c.name = lupdate ${QMAKE_FILE_IN}
48-
lupdate_c.input = TS_FAKEPRO_FILES SOURCES CPP_DUMMIES GENERATED_SOURCES
56+
lupdate_c.input = TS_FAKEPRO_FILES SOURCES CPP_TS_DUMMIES GENERATED_SOURCES
4957
lupdate_c.commands = $$QMAKE_LUPDATE -locations relative -pro-out $$shell_quote($$_PRO_FILE_PWD_) -pro $$shell_quote($$_PRO_FILE_PWD_/.tsdummy.pro.dummy) \
5058
$$escape_expand(\\n\\t)echo created > $$QSETTINGSTRANSLATOR_DIR/.lupdate
5159
lupdate_c.output = $$QSETTINGSTRANSLATOR_DIR/.lupdate
5260
lupdate_c.CONFIG += combine no_link
53-
lupdate_c.depends += $$QMAKE_LUPDATE_EXE
5461
!no_auto_lupdate: lupdate_c.CONFIG += target_predeps
62+
lupdate_c.depends += $$QMAKE_LUPDATE_EXE
5563
QMAKE_EXTRA_COMPILERS += lupdate_c
5664

5765
lupdate_target.target = lupdate

0 commit comments

Comments
 (0)