Skip to content

Commit f67e598

Browse files
MAGETWO-55900: [GitHub] Translate messages on password strength #5509 #5883 #5861
1 parent 73bf648 commit f67e598

File tree

18 files changed

+72
-61
lines changed

18 files changed

+72
-61
lines changed

app/code/Magento/Catalog/view/adminhtml/web/catalog/product-attributes.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@ define([
66
'jquery',
77
'underscore',
88
'uiRegistry',
9-
'jquery/ui'
9+
'jquery/ui',
10+
'mage/translate'
1011
], function ($, _, registry) {
1112
'use strict';
1213

app/code/Magento/Catalog/view/adminhtml/web/component/image-size-field.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@ define([
77
'jquery',
88
'Magento_Ui/js/lib/validation/utils',
99
'Magento_Ui/js/form/element/abstract',
10-
'Magento_Ui/js/lib/validation/validator'
10+
'Magento_Ui/js/lib/validation/validator',
11+
'mage/translate'
1112
], function ($, utils, Abstract, validator) {
1213
'use strict';
1314

app/code/Magento/Catalog/view/frontend/web/js/view/compare-products.js

+10-10
Original file line numberDiff line numberDiff line change
@@ -4,31 +4,31 @@
44
*/
55
define([
66
'uiComponent',
7-
'Magento_Customer/js/customer-data'
7+
'Magento_Customer/js/customer-data',
8+
'mage/translate'
89
], function (Component, customerData) {
910
'use strict';
1011

1112
var sidebarInitialized = false;
1213

1314
function initSidebar() {
1415
if (sidebarInitialized) {
15-
return ;
16+
return;
1617
}
1718
sidebarInitialized = true;
1819
require([
1920
'jquery',
2021
'mage/mage'
2122
], function ($) {
23+
/*eslint-disable max-len*/
2224
$('[data-role=compare-products-sidebar]').mage('compareItems', {
23-
"removeConfirmMessage": $.mage.__(
24-
"Are you sure you want to remove this item from your Compare Products list?"
25-
),
26-
"removeSelector": "#compare-items a.action.delete",
27-
"clearAllConfirmMessage": $.mage.__(
28-
"Are you sure you want to remove all items from your Compare Products list?"
29-
),
30-
"clearAllSelector": "#compare-clear-all"
25+
'removeConfirmMessage': $.mage.__('Are you sure you want to remove this item from your Compare Products list?'),
26+
'removeSelector': '#compare-items a.action.delete',
27+
'clearAllConfirmMessage': $.mage.__('Are you sure you want to remove all items from your Compare Products list?'),
28+
'clearAllSelector': '#compare-clear-all'
3129
});
30+
31+
/*eslint-enable max-len*/
3232
});
3333
}
3434

app/code/Magento/Checkout/view/frontend/web/js/sidebar.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -224,7 +224,7 @@ define([
224224

225225
if (msg) {
226226
alert({
227-
content: $.mage.__(msg)
227+
content: msg
228228
});
229229
}
230230
}

app/code/Magento/Checkout/view/frontend/web/js/view/minicart.js

+3-4
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@ define([
88
'jquery',
99
'ko',
1010
'underscore',
11-
'sidebar'
11+
'sidebar',
12+
'mage/translate'
1213
], function (Component, customerData, $, ko, _) {
1314
'use strict';
1415

@@ -68,9 +69,7 @@ define([
6869
'qty': ':input.cart-item-qty',
6970
'button': ':button.update-cart-item'
7071
},
71-
'confirmMessage': $.mage.__(
72-
'Are you sure you would like to remove this item from the shopping cart?'
73-
)
72+
'confirmMessage': $.mage.__('Are you sure you would like to remove this item from the shopping cart?')
7473
});
7574
}
7675

app/code/Magento/Cms/view/adminhtml/templates/browser/content/uploader.phtml

+2-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,8 @@ require([
2929
'jquery',
3030
'mage/template',
3131
'jquery/file-uploader',
32-
'domReady!'
32+
'domReady!',
33+
'mage/translate'
3334
], function ($, mageTemplate) {
3435
$('#<?php echo $block->getHtmlId() ?> .fileupload').fileupload({
3536
dataType: 'json',

app/code/Magento/ConfigurableProduct/view/adminhtml/web/js/variations/product-grid.js

+3-4
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@ define([
88
'jquery',
99
'Magento_Ui/js/core/app',
1010
'underscore',
11-
'notification'
11+
'notification',
12+
'mage/translate'
1213
], function (Component, $, bootstrap, _) {
1314
'use strict';
1415

@@ -221,9 +222,7 @@ define([
221222

222223
if (data.items.length) {
223224
this.productsModal.notification('add', {
224-
message: $.mage.__(
225-
'Choose a new product to delete and replace the current product configuration.'
226-
),
225+
message: $.mage.__('Choose a new product to delete and replace the current product configuration.'),
227226
messageContainer: this.gridSelector
228227
});
229228
} else {

app/code/Magento/ConfigurableProduct/view/adminhtml/web/js/variations/steps/select_attributes.js

+6-2
Original file line numberDiff line numberDiff line change
@@ -51,9 +51,13 @@ define([
5151
this.setNotificationMessage();
5252
},
5353
setNotificationMessage: function () {
54+
/*eslint-disable max-len*/
55+
var msg = $.mage.__('When you remove or add an attribute, we automatically update all configurations and you will need to recreate current configurations manually.');
56+
57+
/*eslint-enable max-len*/
58+
5459
if (this.mode === 'edit') {
55-
this.wizard.setNotificationMessage($.mage.__('When you remove or add an attribute, we automatically ' +
56-
'update all configurations and you will need to recreate current configurations manually.'));
60+
this.wizard.setNotificationMessage(msg);
5761
}
5862
},
5963
doSelectSavedAttributes: function () {

app/code/Magento/Downloadable/view/adminhtml/templates/product/edit/downloadable/links.phtml

+2-1
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,8 @@ require([
104104
'mage/template',
105105
'jquery/file-uploader',
106106
'mage/mage',
107-
'prototype'
107+
'prototype',
108+
'mage/translate'
108109
], function(jQuery, registry, mageTemplate){
109110
registry.get('downloadable', function (Downloadable) {
110111
var linkTemplate = '<tr>'+

app/code/Magento/Downloadable/view/adminhtml/templates/product/edit/downloadable/samples.phtml

+2-1
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,8 @@ require([
6363
'uiRegistry',
6464
'mage/template',
6565
'jquery/file-uploader',
66-
'prototype'
66+
'prototype',
67+
'mage/translate'
6768
], function (jQuery, registry, mageTemplate) {
6869
registry.get('downloadable', function (Downloadable) {
6970
var sampleTemplate = '<tr>'+

app/code/Magento/Payment/view/frontend/web/js/model/credit-card-validation/validator.js

+7-6
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@
1212
'Magento_Payment/js/model/credit-card-validation/credit-card-number-validator',
1313
'Magento_Payment/js/model/credit-card-validation/expiration-date-validator/expiration-year-validator',
1414
'Magento_Payment/js/model/credit-card-validation/expiration-date-validator/expiration-month-validator',
15-
'Magento_Payment/js/model/credit-card-validation/credit-card-data'
15+
'Magento_Payment/js/model/credit-card-validation/credit-card-data',
16+
'mage/translate'
1617
], factory);
1718
} else {
1819
factory(jQuery);
@@ -40,7 +41,7 @@
4041
return false;
4142
}
4243
},
43-
'Please enter a valid credit card type number.'
44+
$.mage.__('Please enter a valid credit card type number.')
4445
],
4546
'validate-card-number': [
4647
/**
@@ -51,7 +52,7 @@
5152
function (number) {
5253
return creditCardNumberValidator(number).isValid;
5354
},
54-
'Please enter a valid credit card number.'
55+
$.mage.__('Please enter a valid credit card number.')
5556
],
5657
'validate-card-date': [
5758
/**
@@ -62,7 +63,7 @@
6263
function (date) {
6364
return monthValidator(date).isValid;
6465
},
65-
'Incorrect credit card expiration month.'
66+
$.mage.__('Incorrect credit card expiration month.')
6667
],
6768
'validate-card-cvv': [
6869
/**
@@ -74,7 +75,7 @@
7475
var maxLength = creditCardData.creditCard ? creditCardData.creditCard.code.size : 3;
7576
return cvvValidator(cvv, maxLength).isValid;
7677
},
77-
'Please enter a valid credit card verification number.'
78+
$.mage.__('Please enter a valid credit card verification number.')
7879
],
7980
'validate-card-year': [
8081
/**
@@ -85,7 +86,7 @@
8586
function (date) {
8687
return monthValidator(date).isValid;
8788
},
88-
'Incorrect credit card expiration year.'
89+
$.mage.__('Incorrect credit card expiration year.')
8990
]
9091

9192
}, function (i, rule) {

app/code/Magento/Paypal/view/frontend/web/order-review.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ define([
132132
}
133133
}
134134
alert({
135-
content: $.mage.__(msg)
135+
content: msg
136136
});
137137
return false;
138138
}

app/code/Magento/ProductVideo/view/adminhtml/web/js/get-video-information.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@
66
define([
77
'jquery',
88
'Magento_Ui/js/modal/alert',
9-
'jquery/ui'
9+
'jquery/ui',
10+
'mage/translate'
1011
], function ($, alert) {
1112
'use strict';
1213

app/code/Magento/Swatches/view/adminhtml/web/js/type-change.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@
33
* See COPYING.txt for license details.
44
*/
55
require([
6-
'jquery'
6+
'jquery',
7+
'mage/translate'
78
], function ($) {
89
'use strict';
910

app/code/Magento/Theme/view/adminhtml/templates/browser/content/uploader.phtml

+2-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,8 @@ require([
3333
'jquery',
3434
'mage/template',
3535
'jquery/file-uploader',
36-
'domReady!'
36+
'domReady!',
37+
'mage/translate'
3738
], function ($, mageTemplate) {
3839

3940
$('#fileupload').fileupload({

app/code/Magento/Ui/view/base/web/js/grid/columns/thumbnail.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@ define([
77
'jquery',
88
'mage/template',
99
'text!Magento_Ui/templates/grid/cells/thumbnail/preview.html',
10-
'Magento_Ui/js/modal/modal'
10+
'Magento_Ui/js/modal/modal',
11+
'mage/translate'
1112
], function (Column, $, mageTemplate, thumbnailPreviewTemplate) {
1213
'use strict';
1314

app/code/Magento/Ui/view/base/web/js/lib/validation/rules.js

+11-9
Original file line numberDiff line numberDiff line change
@@ -430,10 +430,10 @@ define([
430430
var pass = $.trim(v);
431431
var result = pass.length >= passwordMinLength;
432432
if (result == false) {
433-
validator.passwordErrorMessage = $.mage.__(
434-
"Minimum length of this field must be equal or greater than %1 symbols." +
435-
" Leading and trailing spaces will be ignored."
436-
).replace('%1', passwordMinLength);
433+
/*eslint-disable max-len*/
434+
validator.passwordErrorMessage = $.mage.__('Minimum length of this field must be equal or greater than %1 symbols. Leading and trailing spaces will be ignored.').replace('%1', passwordMinLength);
435+
436+
/*eslint-enable max-len*/
437437
return result;
438438
}
439439
if (pass.match(/\d+/)) {
@@ -450,10 +450,11 @@ define([
450450
}
451451
if (counter < passwordMinCharacterSets) {
452452
result = false;
453-
validator.passwordErrorMessage = $.mage.__(
454-
"Minimum of different classes of characters in password is %1." +
455-
" Classes of characters: Lower Case, Upper Case, Digits, Special Characters."
456-
).replace('%1', passwordMinCharacterSets);
453+
454+
/*eslint-disable max-len*/
455+
validator.passwordErrorMessage = $.mage.__('Minimum of different classes of characters in password is %1. Classes of characters: Lower Case, Upper Case, Digits, Special Characters.').replace('%1', passwordMinCharacterSets);
456+
457+
/*eslint-enable max-len*/
457458
}
458459
return result;
459460
}, function () {
@@ -741,7 +742,8 @@ define([
741742
}
742743
}
743744
return true;
744-
}, "Please enter valid email addresses, separated by commas. For example, [email protected], [email protected]."
745+
},
746+
$.mage.__('Please enter valid email addresses, separated by commas. For example, [email protected], [email protected].')
745747
],
746748
"validate-cc-number": [
747749
/**

lib/web/mage/validation.js

+12-15
Original file line numberDiff line numberDiff line change
@@ -545,10 +545,10 @@
545545
var pass = $.trim(v);
546546
var result = pass.length >= passwordMinLength;
547547
if (result == false) {
548-
validator.passwordErrorMessage = $.mage.__(
549-
"Minimum length of this field must be equal or greater than %1 symbols." +
550-
" Leading and trailing spaces will be ignored."
551-
).replace('%1', passwordMinLength);
548+
/*eslint-disable max-len*/
549+
validator.passwordErrorMessage = $.mage.__('Minimum length of this field must be equal or greater than %1 symbols. Leading and trailing spaces will be ignored.').replace('%1', passwordMinLength);
550+
551+
/*eslint-enable max-len*/
552552
return result;
553553
}
554554
if (pass.match(/\d+/)) {
@@ -565,10 +565,11 @@
565565
}
566566
if (counter < passwordMinCharacterSets) {
567567
result = false;
568-
validator.passwordErrorMessage = $.mage.__(
569-
"Minimum of different classes of characters in password is %1." +
570-
" Classes of characters: Lower Case, Upper Case, Digits, Special Characters."
571-
).replace('%1', passwordMinCharacterSets);
568+
569+
/*eslint-disable max-len*/
570+
validator.passwordErrorMessage = $.mage.__('Minimum of different classes of characters in password is %1. Classes of characters: Lower Case, Upper Case, Digits, Special Characters.').replace('%1', passwordMinCharacterSets);
571+
572+
/*eslint-enable max-len*/
572573
}
573574
return result;
574575
}, function () {
@@ -984,7 +985,7 @@
984985

985986
return !!container.querySelectorAll(selector).length;
986987
},
987-
'Please select one of the options.'
988+
$.mage.__('Please select one of the options.')
988989
],
989990
"less-than-equals-to": [
990991
function (value, element, params) {
@@ -1145,16 +1146,12 @@
11451146
if (name.match(reMax) && result) {
11461147
length = name.split('-')[2];
11471148
result = (v.length <= length);
1148-
validator.validateMessage = $.mage.__(
1149-
"Please enter less or equal than %1 symbols."
1150-
).replace('%1', length);
1149+
validator.validateMessage = $.mage.__('Please enter less or equal than %1 symbols.').replace('%1', length);
11511150
}
11521151
if (name.match(reMin) && result && !$.mage.isEmpty(v)) {
11531152
length = name.split('-')[2];
11541153
result = v.length >= length;
1155-
validator.validateMessage = $.mage.__(
1156-
"Please enter more or equal than %1 symbols."
1157-
).replace('%1', length);
1154+
validator.validateMessage = $.mage.__('Please enter more or equal than %1 symbols.').replace('%1', length);
11581155
}
11591156
});
11601157
return result;

0 commit comments

Comments
 (0)