Skip to content

Commit 222590f

Browse files
committed
Merge branch 'hotfix/translation_loader' into 'feature/2.3.0'
Changes for translation loader See merge request metamodels/filter_checkbox!20
2 parents 6fb42c5 + 000a155 commit 222590f

File tree

7 files changed

+155
-97
lines changed

7 files changed

+155
-97
lines changed

.tx/config

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
[main]
2+
host = https://app.transifex.com
3+
4+
[o:metamodels:p:filter-checkbox:r:tl_metamodel_filtersetting]
5+
file_filter = src/Resources/translations/tl_metamodel_filtersetting.<lang>.xlf
6+
source_file = src/Resources/translations/tl_metamodel_filtersetting.en.xlf
7+
type = XLIFF
8+
minimum_perc = 0
9+
resource_name = tl_metamodel_filtersetting
10+
replace_edited_strings = false
11+
keep_translations = false

src/FilterSetting/Checkbox.php

Lines changed: 18 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -107,8 +107,8 @@ public function getParameterDCA()
107107
$this->getParamValue('no') => $this->getParamValue('no')
108108
],
109109
'reference' => [
110-
$this->getParamValue('yes') => $GLOBALS['TL_LANG']['MSC']['yes'],
111-
$this->getParamValue('no') => $GLOBALS['TL_LANG']['MSC']['no']
110+
$this->getParamValue('yes') => $this->translator->trans('MSC.yes', [], 'contao_default'),
111+
$this->getParamValue('no') => $this->translator->trans('MSC.no', [], 'contao_default')
112112
],
113113
'eval' => [
114114
'includeBlankOption' => $this->get('blankoption')
@@ -183,13 +183,13 @@ public function getParameterFilterWidgets(
183183
1 => $this->getParamValue('no')
184184
];
185185
$arrWidget['reference'] = [
186-
$this->getParamValue('yes') => $GLOBALS['TL_LANG']['MSC']['yes'],
187-
$this->getParamValue('no') => $GLOBALS['TL_LANG']['MSC']['no']
186+
$this->getParamValue('yes') => $this->translator->trans('MSC.yes', [], 'contao_default'),
187+
$this->getParamValue('no') => $this->translator->trans('MSC.no', [], 'contao_default')
188188
];
189189
}
190190

191191
if ($arrWidget['eval']['includeBlankOption']) {
192-
$arrWidget['eval']['blankOptionLabel'] = $GLOBALS['TL_LANG']['metamodels_frontendfilter']['do_not_filter'];
192+
$arrWidget['eval']['blankOptionLabel'] = $this->translator->trans('do_not_filter', [], 'metamodels_filter');
193193
}
194194

195195
if ($this->get('ynmode') !== 'radio' && $this->get('option_label_param')) {
@@ -254,21 +254,23 @@ private function prepareLabel(IAttribute $objAttribute)
254254
[
255255
($this->get('label') ?: $objAttribute->getName()),
256256
($this->get('ynmode') === 'yes'
257-
? $GLOBALS['TL_LANG']['MSC']['yes']
258-
: $GLOBALS['TL_LANG']['MSC']['no']
257+
? $this->translator->trans('MSC.yes', [], 'contao_default')
258+
: $this->translator->trans('MSC.no', [], 'contao_default')
259259
)
260260
]
261261
:
262262
[
263263
($this->get('label') ?: $objAttribute->getName()),
264264
($this->get('ynmode') === 'yes'
265-
? sprintf(
266-
$GLOBALS['TL_LANG']['MSC']['extended_yes'],
267-
($this->get('label') ?: $objAttribute->getName())
265+
? $this->translator->trans(
266+
'extended_yes',
267+
['%attribute%' => ($this->get('label') ?: $objAttribute->getName())],
268+
'tl_metamodel_filtersetting'
268269
)
269-
: sprintf(
270-
$GLOBALS['TL_LANG']['MSC']['extended_no'],
271-
($this->get('label') ?: $objAttribute->getName())
270+
: $this->translator->trans(
271+
'extended_nos',
272+
['%attribute%' => ($this->get('label') ?: $objAttribute->getName())],
273+
'tl_metamodel_filtersetting'
272274
)
273275
)
274276
]
@@ -287,7 +289,9 @@ private function prepareLabel(IAttribute $objAttribute)
287289
private function getParamValue(string $value): string
288290
{
289291
if ($this->get('option_label_param')) {
290-
return 'yes' === $value ? $GLOBALS['TL_LANG']['MSC']['yes'] : $GLOBALS['TL_LANG']['MSC']['no'];
292+
return 'yes' === $value
293+
? $this->translator->trans('MSC.yes', [], 'contao_default')
294+
: $this->translator->trans('MSC.no', [], 'contao_default');
291295
}
292296

293297
return 'yes' === $value ? '1' : '-1';

src/Resources/contao/dca/tl_metamodel_filtersetting.php

Lines changed: 29 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
/**
44
* This file is part of MetaModels/filter_checkbox.
55
*
6-
* (c) 2012-2022 The MetaModels team.
6+
* (c) 2012-2024 The MetaModels team.
77
*
88
* For the full copyright and license information, please view the LICENSE
99
* file that was distributed with this source code.
@@ -17,7 +17,7 @@
1717
* @author Christian de la Haye <service@delahaye.de>
1818
* @author Richard Henkenjohann <richardhenkenjohann@googlemail.com>
1919
* @author Ingolf Steinhardt <info@e-spin.de>
20-
* @copyright 2012-2022 The MetaModels team.
20+
* @copyright 2012-2024 The MetaModels team.
2121
* @license https://github.com/MetaModels/filter_checkbox/blob/master/LICENSE LGPL-3.0-or-later
2222
* @filesource
2323
*/
@@ -44,41 +44,48 @@
4444
$GLOBALS['TL_DCA']['tl_metamodel_filtersetting']['metasubselectpalettes']['ynmode']['radio'] = ['blankoption'];
4545

4646
$GLOBALS['TL_DCA']['tl_metamodel_filtersetting']['fields']['ynfield'] = [
47-
'label' => &$GLOBALS['TL_LANG']['tl_metamodel_filtersetting']['ynfield'],
48-
'exclude' => true,
49-
'default' => '1',
50-
'inputType' => 'checkbox',
51-
'eval' => [
47+
'label' => 'ynfield.label',
48+
'description' => 'ynfield.description',
49+
'exclude' => true,
50+
'default' => '1',
51+
'inputType' => 'checkbox',
52+
'eval' => [
5253
'tl_class' => 'w50 cbx m12',
5354
],
54-
'sql' => 'char(1) NOT NULL default \'1\'',
55+
'sql' => 'char(1) NOT NULL default \'1\'',
5556
];
5657

5758
$GLOBALS['TL_DCA']['tl_metamodel_filtersetting']['fields']['ynmode'] = [
58-
'label' => &$GLOBALS['TL_LANG']['tl_metamodel_filtersetting']['ynmode'],
59-
'exclude' => true,
60-
'inputType' => 'radio',
61-
'default' => 'yes',
62-
'options' => [
59+
'label' => 'ynmode.label',
60+
'description' => 'ynmode.description',
61+
'exclude' => true,
62+
'inputType' => 'radio',
63+
'default' => 'yes',
64+
'options' => [
6365
'yes',
6466
'no',
6567
'radio',
6668
],
67-
'reference' => &$GLOBALS['TL_LANG']['tl_metamodel_filtersetting'],
68-
'eval' => [
69+
'reference' => [
70+
'yes' => 'ynmode.yes',
71+
'no' => 'ynmode.no',
72+
'radio' => 'ynmode.radio',
73+
],
74+
'eval' => [
6975
'tl_class' => 'w50 clr',
7076
'submitOnChange' => true,
7177
],
72-
'sql' => 'varchar(8) NOT NULL default \'yes\'',
78+
'sql' => 'varchar(8) NOT NULL default \'yes\'',
7379
];
7480

7581
$GLOBALS['TL_DCA']['tl_metamodel_filtersetting']['fields']['option_label_param'] = [
76-
'label' => &$GLOBALS['TL_LANG']['tl_metamodel_filtersetting']['option_label_param'],
77-
'exclude' => true,
78-
'default' => '1',
79-
'inputType' => 'checkbox',
80-
'eval' => [
82+
'label' => 'option_label_param.label',
83+
'description' => 'option_label_param.description',
84+
'exclude' => true,
85+
'default' => '1',
86+
'inputType' => 'checkbox',
87+
'eval' => [
8188
'tl_class' => 'w50 cbx m12',
8289
],
83-
'sql' => 'char(1) NOT NULL default \'1\'',
90+
'sql' => 'char(1) NOT NULL default \'1\'',
8491
];

src/Resources/contao/languages/en/default.php

Lines changed: 0 additions & 25 deletions
This file was deleted.

src/Resources/contao/languages/en/tl_metamodel_filtersetting.php

Lines changed: 0 additions & 36 deletions
This file was deleted.
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
<?xml version="1.0" ?><xliff xmlns="urn:oasis:names:tc:xliff:document:1.2" version="1.2">
2+
<file source-language="en" datatype="plaintext" original="src/Resources/translations/tl_metamodel_filtersetting.en.xlf" target-language="de">
3+
<body>
4+
<trans-unit id="typenames.checkbox" resname="typenames.checkbox">
5+
<source>Yes/no</source>
6+
<target>Ja / Nein</target>
7+
</trans-unit>
8+
<trans-unit id="ynfield.label" resname="ynfield.label">
9+
<source>Yes/no instead of attribute name</source>
10+
<target>&quot;Ja/Nein&quot; anstatt Attribut-Name</target>
11+
</trans-unit>
12+
<trans-unit id="ynfield.description" resname="ynfield.description">
13+
<source>Show yes/no instead of attribute name and provide attribute name as a headline.</source>
14+
<target>Zeige &quot;Ja/Nein&quot; anstelle des Attribut-Namens. Dieser Attribut-Name steht auch als Überschrift zur Verfügung.</target>
15+
</trans-unit>
16+
<trans-unit id="ynmode.label" resname="ynmode.label">
17+
<source>Modus</source>
18+
<target>Modus</target>
19+
</trans-unit>
20+
<trans-unit id="ynmode.description" resname="ynmode.description">
21+
<source>Make yes/no selectable.</source>
22+
<target>Mache ja/nein auswählbar.</target>
23+
</trans-unit>
24+
<trans-unit id="option_label_param.label" resname="option_label_param.label">
25+
<source>Option label as parameter</source>
26+
<target>Optionsbezeichnung als Parameter</target>
27+
</trans-unit>
28+
<trans-unit id="option_label_param.description" resname="option_label_param.description">
29+
<source>If this checkbox set, the parameter value is the option label instead a number.</source>
30+
<target>Wenn dieses Kontrollkästchen aktiviert ist, ist der Parameterwert die Bezeichnung der Option und nicht eine Zahl.</target>
31+
</trans-unit>
32+
<trans-unit id="ynmode.yes" resname="ynmode.yes">
33+
<source>Checkbox yes</source>
34+
<target>Ja-Checkbox</target>
35+
</trans-unit>
36+
<trans-unit id="ynmode.no" resname="ynmode.no">
37+
<source>Checkbox no</source>
38+
<target>Nein-Checkbox</target>
39+
</trans-unit>
40+
<trans-unit id="ynmode.radio" resname="ynmode.radio">
41+
<source>Radio selection</source>
42+
<target>Radio-Buttons</target>
43+
</trans-unit>
44+
<trans-unit id="extended_no" resname="extended_no">
45+
<source>%attribute%: no</source>
46+
<target>%attribute%: nein</target>
47+
</trans-unit>
48+
<trans-unit id="extended_yes" resname="extended_yes">
49+
<source>%attribute%: yes</source>
50+
<target>%attribute%: ja</target>
51+
</trans-unit>
52+
</body>
53+
</file>
54+
</xliff>
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<xliff xmlns="urn:oasis:names:tc:xliff:document:1.2" version="1.2">
3+
<file source-language="en" datatype="plaintext" original="src/Resources/translations/tl_metamodel_filtersetting.en.xlf">
4+
<body>
5+
<trans-unit id="typenames.checkbox" resname="typenames.checkbox">
6+
<source>Yes/no</source>
7+
</trans-unit>
8+
<trans-unit id="ynfield.label" resname="ynfield.label">
9+
<source>Yes/no instead of attribute name</source>
10+
</trans-unit>
11+
<trans-unit id="ynfield.description" resname="ynfield.description">
12+
<source>Show yes/no instead of attribute name and provide attribute name as a headline.</source>
13+
</trans-unit>
14+
<trans-unit id="ynmode.label" resname="ynmode.label">
15+
<source>Modus</source>
16+
</trans-unit>
17+
<trans-unit id="ynmode.description" resname="ynmode.description">
18+
<source>Make yes/no selectable.</source>
19+
</trans-unit>
20+
<trans-unit id="option_label_param.label" resname="option_label_param.label">
21+
<source>Option label as parameter</source>
22+
</trans-unit>
23+
<trans-unit id="option_label_param.description" resname="option_label_param.description">
24+
<source>If this checkbox set, the parameter value is the option label instead a number.</source>
25+
</trans-unit>
26+
<trans-unit id="ynmode.yes" resname="ynmode.yes">
27+
<source>Checkbox yes</source>
28+
</trans-unit>
29+
<trans-unit id="ynmode.no" resname="ynmode.no">
30+
<source>Checkbox no</source>
31+
</trans-unit>
32+
<trans-unit id="ynmode.radio" resname="ynmode.radio">
33+
<source>Radio selection</source>
34+
</trans-unit>
35+
<trans-unit id="extended_no" resname="extended_no">
36+
<source>%attribute%: no</source>
37+
</trans-unit>
38+
<trans-unit id="extended_yes" resname="extended_yes">
39+
<source>%attribute%: yes</source>
40+
</trans-unit>
41+
</body>
42+
</file>
43+
</xliff>

0 commit comments

Comments
 (0)