Skip to content

Commit c27408b

Browse files
authored
Merge pull request #127 from leemyongpakvn/dev
shorten trans call
2 parents c8e2f17 + 755b2f1 commit c27408b

2 files changed

Lines changed: 25 additions & 25 deletions

File tree

classes/Form/ConfigurationForm.php

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -70,88 +70,88 @@ public function generate()
7070
$helper->submit_action = 'submit' . $this->module->name;
7171
$helper->toolbar_btn = [
7272
'save' => [
73-
'desc' => $this->module->getTranslator()->trans('Save', [], 'Modules.GAnalytics.Admin'),
73+
'desc' => $this->module->trans('Save', [], 'Modules.GAnalytics.Admin'),
7474
'href' => AdminController::$currentIndex . '&configure=' . $this->module->name . '&save=' . $this->module->name .
7575
'&token=' . $helper->token,
7676
],
7777
'back' => [
7878
'href' => AdminController::$currentIndex . '&token=' . $helper->token,
79-
'desc' => $this->module->getTranslator()->trans('Back to list', [], 'Modules.GAnalytics.Admin'),
79+
'desc' => $this->module->trans('Back to list', [], 'Modules.GAnalytics.Admin'),
8080
],
8181
];
8282

8383
$fields_form = [];
8484
// Init Fields form array
8585
$fields_form[0]['form'] = [
8686
'legend' => [
87-
'title' => $this->module->getTranslator()->trans('Settings', [], 'Modules.GAnalytics.Admin'),
87+
'title' => $this->module->trans('Settings', [], 'Modules.GAnalytics.Admin'),
8888
],
8989
'input' => [
9090
[
9191
'type' => 'text',
92-
'label' => $this->module->getTranslator()->trans('Google Analytics Tracking ID', [], 'Modules.GAnalytics.Admin'),
92+
'label' => $this->module->trans('Google Analytics Tracking ID', [], 'Modules.GAnalytics.Admin'),
9393
'name' => 'GA_ACCOUNT_ID',
9494
'size' => 20,
9595
'required' => true,
96-
'hint' => $this->module->getTranslator()->trans('This information is available in your Google Analytics account', [], 'Modules.GAnalytics.Admin'),
96+
'hint' => $this->module->trans('This information is available in your Google Analytics account', [], 'Modules.GAnalytics.Admin'),
9797
],
9898
[
9999
'type' => 'switch',
100-
'label' => $this->module->getTranslator()->trans('Enable User ID tracking', [], 'Modules.GAnalytics.Admin'),
100+
'label' => $this->module->trans('Enable User ID tracking', [], 'Modules.GAnalytics.Admin'),
101101
'name' => 'GA_USERID_ENABLED',
102102
'values' => [
103103
[
104104
'id' => 'ga_userid_enabled',
105105
'value' => 1,
106-
'label' => $this->module->getTranslator()->trans('Yes', [], 'Modules.GAnalytics.Admin'),
106+
'label' => $this->module->trans('Yes', [], 'Modules.GAnalytics.Admin'),
107107
],
108108
[
109109
'id' => 'ga_userid_disabled',
110110
'value' => 0,
111-
'label' => $this->module->getTranslator()->trans('No', [], 'Modules.GAnalytics.Admin'),
111+
'label' => $this->module->trans('No', [], 'Modules.GAnalytics.Admin'),
112112
], ],
113113
],
114114
[
115115
'type' => 'switch',
116-
'label' => $this->module->getTranslator()->trans('Anonymize IP', [], 'Modules.GAnalytics.Admin'),
116+
'label' => $this->module->trans('Anonymize IP', [], 'Modules.GAnalytics.Admin'),
117117
'name' => 'GA_ANONYMIZE_ENABLED',
118-
'hint' => $this->module->getTranslator()->trans('Use this option to anonymize the visitor’s IP to comply with data privacy laws in some countries', [], 'Modules.GAnalytics.Admin'),
118+
'hint' => $this->module->trans('Use this option to anonymize the visitor’s IP to comply with data privacy laws in some countries', [], 'Modules.GAnalytics.Admin'),
119119
'values' => [
120120
[
121121
'id' => 'ga_anonymize_enabled',
122122
'value' => 1,
123-
'label' => $this->module->getTranslator()->trans('Yes', [], 'Modules.GAnalytics.Admin'),
123+
'label' => $this->module->trans('Yes', [], 'Modules.GAnalytics.Admin'),
124124
],
125125
[
126126
'id' => 'ga_anonymize_disabled',
127127
'value' => 0,
128-
'label' => $this->module->getTranslator()->trans('No', [], 'Modules.GAnalytics.Admin'),
128+
'label' => $this->module->trans('No', [], 'Modules.GAnalytics.Admin'),
129129
],
130130
],
131131
],
132132
[
133133
'type' => 'switch',
134-
'label' => $this->module->getTranslator()->trans('Enable Back Office Tracking', [], 'Modules.GAnalytics.Admin'),
134+
'label' => $this->module->trans('Enable Back Office Tracking', [], 'Modules.GAnalytics.Admin'),
135135
'name' => 'GA_TRACK_BACKOFFICE_ENABLED',
136-
'hint' => $this->module->getTranslator()->trans('Use this option to enable the tracking inside the Back Office', [], 'Modules.GAnalytics.Admin'),
136+
'hint' => $this->module->trans('Use this option to enable the tracking inside the Back Office', [], 'Modules.GAnalytics.Admin'),
137137
'values' => [
138138
[
139139
'id' => 'ga_track_backoffice',
140140
'value' => 1,
141-
'label' => $this->module->getTranslator()->trans('Yes', [], 'Modules.GAnalytics.Admin'),
141+
'label' => $this->module->trans('Yes', [], 'Modules.GAnalytics.Admin'),
142142
],
143143
[
144144
'id' => 'ga_do_not_track_backoffice',
145145
'value' => 0,
146-
'label' => $this->module->getTranslator()->trans('No', [], 'Modules.GAnalytics.Admin'),
146+
'label' => $this->module->trans('No', [], 'Modules.GAnalytics.Admin'),
147147
],
148148
],
149149
],
150150
[
151151
'type' => 'select',
152-
'label' => $this->module->getTranslator()->trans('Canceled order states', [], 'Modules.GAnalytics.Admin'),
152+
'label' => $this->module->trans('Canceled order states', [], 'Modules.GAnalytics.Admin'),
153153
'name' => 'GA_CANCELLED_STATES',
154-
'desc' => $this->module->getTranslator()->trans('Choose order states, in which you consider the given order canceled. This will usually be the default "Canceled" state, but some shops may have extra states like "Returned" etc.', [], 'Modules.GAnalytics.Admin'),
154+
'desc' => $this->module->trans('Choose order states, in which you consider the given order canceled. This will usually be the default "Canceled" state, but some shops may have extra states like "Returned" etc.', [], 'Modules.GAnalytics.Admin'),
155155
'class' => 'chosen',
156156
'multiple' => true,
157157
'options' => [
@@ -162,25 +162,25 @@ public function generate()
162162
],
163163
],
164164
'submit' => [
165-
'title' => $this->module->getTranslator()->trans('Save', [], 'Modules.GAnalytics.Admin'),
165+
'title' => $this->module->trans('Save', [], 'Modules.GAnalytics.Admin'),
166166
],
167167
];
168168

169169
if ($is_multistore_active) {
170170
$fields_form[0]['form']['input'][] = [
171171
'type' => 'switch',
172-
'label' => $this->module->getTranslator()->trans('Enable Cross-Domain tracking', [], 'Modules.GAnalytics.Admin'),
172+
'label' => $this->module->trans('Enable Cross-Domain tracking', [], 'Modules.GAnalytics.Admin'),
173173
'name' => 'GA_CROSSDOMAIN_ENABLED',
174174
'values' => [
175175
[
176176
'id' => 'ga_crossdomain_enabled',
177177
'value' => 1,
178-
'label' => $this->module->getTranslator()->trans('Yes', [], 'Modules.GAnalytics.Admin'),
178+
'label' => $this->module->trans('Yes', [], 'Modules.GAnalytics.Admin'),
179179
],
180180
[
181181
'id' => 'ga_crossdomain_disabled',
182182
'value' => 0,
183-
'label' => $this->module->getTranslator()->trans('No', [], 'Modules.GAnalytics.Admin'),
183+
'label' => $this->module->trans('No', [], 'Modules.GAnalytics.Admin'),
184184
],
185185
],
186186
];
@@ -223,12 +223,12 @@ public function treat()
223223

224224
if (null !== $gaUserIdEnabled) {
225225
Configuration::updateValue('GA_USERID_ENABLED', (bool) $gaUserIdEnabled);
226-
$treatmentResult .= $this->module->displayConfirmation($this->module->getTranslator()->trans('Settings for User ID updated successfully', [], 'Modules.GAnalytics.Admin'));
226+
$treatmentResult .= $this->module->displayConfirmation($this->module->trans('Settings for User ID updated successfully', [], 'Modules.GAnalytics.Admin'));
227227
}
228228

229229
if ($is_multistore_active) {
230230
Configuration::updateValue('GA_CROSSDOMAIN_ENABLED', (bool) $gaCrossdomainEnabled);
231-
$treatmentResult .= $this->module->displayConfirmation($this->module->getTranslator()->trans('Settings for Cross-Domain updated successfully', [], 'Modules.GAnalytics.Admin'));
231+
$treatmentResult .= $this->module->displayConfirmation($this->module->trans('Settings for Cross-Domain updated successfully', [], 'Modules.GAnalytics.Admin'));
232232
}
233233

234234
if (null !== $gaAnonymizeEnabled) {

ps_googleanalytics.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -250,7 +250,7 @@ public function uninstall()
250250
* @param string|null $domain
251251
* @param string|null $locale
252252
*/
253-
protected function trans($id, array $parameters = [], $domain = null, $locale = null)
253+
public function trans($id, array $parameters = [], $domain = null, $locale = null)
254254
{
255255
if (method_exists('Module', 'trans')) {
256256
return parent::trans($id, $parameters, $domain, $locale);

0 commit comments

Comments
 (0)