Skip to content

Commit a0e2f0d

Browse files
MAGETWO-70599: Product Edit Page Can't Load
- Fix regexp and data for testing
1 parent 29361a3 commit a0e2f0d

File tree

5 files changed

+26
-36
lines changed

5 files changed

+26
-36
lines changed

app/code/Magento/Braintree/view/frontend/web/js/view/payment/method-renderer/cc-form.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ define(
7878
* @param {Object} response
7979
*/
8080
onError: function (response) {
81-
braintree.showError($t('Payment {title} can\'t be initialized').replace('{title}', this.getTitle()));
81+
braintree.showError($t('Payment ' + this.getTitle() + ' can\'t be initialized'));
8282
this.isPlaceOrderActionAllowed(true);
8383
throw response.message;
8484
},

app/code/Magento/Braintree/view/frontend/web/js/view/payment/method-renderer/paypal.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -428,7 +428,7 @@ define([
428428
Braintree.checkout.paypal.initAuthFlow();
429429
} catch (e) {
430430
this.messageContainer.addErrorMessage({
431-
message: $t('Payment {title} can\'t be initialized').replace('{title}', this.getTitle())
431+
message: $t('Payment ' + this.getTitle() + ' can\'t be initialized.')
432432
});
433433
}
434434
},

app/code/Magento/Catalog/view/adminhtml/web/catalog/base-image-uploader.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,8 @@ define([
171171
if (data.files.length > this.options.maxImageUploadCount) {
172172
$('body').notification('clear').notification('add', {
173173
error: true,
174-
message: $.mage.__('You can\'t upload more than {count} images in one time').replace('{count}', this.options.maxImageUploadCount),
174+
message: $.mage.__('You can\'t upload more than ' + this.options.maxImageUploadCount +
175+
' images in one time'),
175176

176177
/**
177178
* @param {*} message

app/code/Magento/Translation/etc/di.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,8 +65,8 @@
6565
<argument name="patterns" xsi:type="array">
6666
<item name="i18n_translation" xsi:type="string"><![CDATA[~i18n\:\s*(["'])(.*?)(?<!\\)\1~]]></item>
6767
<item name="translate_wrapping" xsi:type="string"><![CDATA[~translate\=("')([^\'].*?)\'\"~]]></item>
68-
<item name="mage_translation_widget" xsi:type="string"><![CDATA[~(?:\$|jQuery)\.mage\.__\((?s)\s*(['"])(?<translate>.+?)(?<!\\)\1\s*(?s)\)~]]></item>
69-
<item name="mage_translation_static" xsi:type="string"><![CDATA[~\$t\((?s)\s*(["'])(?<translate>[^']+(?!\s*\+\s*')+?)\1\s*(?s)\)~]]></item>
68+
<item name="mage_translation_widget" xsi:type="string"><![CDATA[~(?s)(?:\$|jQuery)\.mage\.__\(\s*(['"])(?<translate>.+?)(?<!\\)\1\s*(*SKIP)\)\s*(?s)~]]></item>
69+
<item name="mage_translation_static" xsi:type="string"><![CDATA[~(?s)\$t\(\s*(['"])(?<translate>.+?)(?<!\\)\1\s*(*SKIP)\)(?s)~]]></item>
7070
<item name="translate_args" xsi:type="string"><![CDATA[~translate args\=("|'|"')([^\'].*?)('"|'|")~]]></item>
7171
</argument>
7272
</arguments>

dev/tests/integration/testsuite/Magento/Translation/Model/Js/PreProcessorTest.php

Lines changed: 20 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ public function testProcess(string $content, string $translation)
9191
public function contentForTranslateDataProvider()
9292
{
9393
return [
94-
[
94+
'previousError' => [
9595
'setTranslateProp = function (el, original) {
9696
var location = $(el).prop(\'tagName\').toLowerCase(),
9797
translated = $.mage.__(original),
@@ -121,60 +121,49 @@ public function contentForTranslateDataProvider()
121121
setText(el, translationData.shown);
122122
},'
123123
],
124-
[
125-
<<<EOT
124+
'checkTranslationWithWhiteSpaces' => [
125+
<<<i18n
126126
title: $.mage.__(
127127
'Original value for Magento_Store module'
128128
),
129-
EOT
130-
,
131-
<<<EOT
132-
title: 'Translated value for Magento_Store module in en_AU',
133-
EOT
134-
],
135-
[
136-
<<<EOT
137129
title: \$t(
138130
'Original value for Magento_Store module'
139131
);
140-
EOT
132+
i18n
141133
,
142-
<<<EOT
134+
<<<i18n
135+
title: 'Translated value for Magento_Store module in en_AU',
143136
title: 'Translated value for Magento_Store module in en_AU';
144-
EOT
137+
i18n
145138
],
146-
[
147-
<<<EOT
139+
'checkTranslationWithReplace' => [
140+
<<<i18n
148141
$.mage.__('The maximum you may purchase is %1.').replace('%1', params.maxAllowed);
149-
EOT
142+
\$t('The maximum you may purchase is %1.').replace('%1', params.maxAllowed);
143+
i18n
150144
,
151-
<<<EOT
145+
<<<i18n
146+
'The maximum you may purchase is %1.'.replace('%1', params.maxAllowed);
152147
'The maximum you may purchase is %1.'.replace('%1', params.maxAllowed);
153-
EOT
148+
i18n
154149
],
155-
[
156-
<<<EOT
157-
\$t("text double quote");
158-
\$t('text "some');
150+
'checkAvoidingMatching' => [
151+
<<<i18n
159152
\$t('Payment ' + this.getTitle() + ' can\'t be initialized')
160-
\$t('The maximum you may purchase is %1.').replace('%1', params.maxAllowed);
161153
\$t(
162154
'Set unique country-state combinations within the same fixed product tax. ' +
163155
'Verify the combinations and try again.'
164156
)
165-
EOT
157+
i18n
166158
,
167-
<<<EOT
168-
'text double quote';
169-
'text "some';
159+
<<<i18n
170160
\$t('Payment ' + this.getTitle() + ' can\'t be initialized')
171-
'The maximum you may purchase is %1.'.replace('%1', params.maxAllowed);
172161
\$t(
173162
'Set unique country-state combinations within the same fixed product tax. ' +
174163
'Verify the combinations and try again.'
175164
)
176-
EOT
177-
],
165+
i18n
166+
]
178167
];
179168
}
180169
}

0 commit comments

Comments
 (0)