Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Backport of MAGETWO-55900 for Magento 2.1: [GitHub] Translate message… #10747

Merged
merged 1 commit into from
Sep 2, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ define([
'jquery',
'underscore',
'uiRegistry',
'jquery/ui'
'jquery/ui',
'mage/translate'
], function ($, _, registry) {
'use strict';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ define([
'jquery',
'Magento_Ui/js/lib/validation/utils',
'Magento_Ui/js/form/element/abstract',
'Magento_Ui/js/lib/validation/validator'
'Magento_Ui/js/lib/validation/validator',
'mage/translate'
], function ($, utils, Abstract, validator) {
'use strict';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,31 +4,31 @@
*/
define([
'uiComponent',
'Magento_Customer/js/customer-data'
'Magento_Customer/js/customer-data',
'mage/translate'
], function (Component, customerData) {
'use strict';

var sidebarInitialized = false;

function initSidebar() {
if (sidebarInitialized) {
return ;
return;
}
sidebarInitialized = true;
require([
'jquery',
'mage/mage'
], function ($) {
/*eslint-disable max-len*/
$('[data-role=compare-products-sidebar]').mage('compareItems', {
"removeConfirmMessage": $.mage.__(
"Are you sure you want to remove this item from your Compare Products list?"
),
"removeSelector": "#compare-items a.action.delete",
"clearAllConfirmMessage": $.mage.__(
"Are you sure you want to remove all items from your Compare Products list?"
),
"clearAllSelector": "#compare-clear-all"
'removeConfirmMessage': $.mage.__('Are you sure you want to remove this item from your Compare Products list?'),
'removeSelector': '#compare-items a.action.delete',
'clearAllConfirmMessage': $.mage.__('Are you sure you want to remove all items from your Compare Products list?'),
'clearAllSelector': '#compare-clear-all'
});

/*eslint-enable max-len*/
});
}

Expand Down
2 changes: 1 addition & 1 deletion app/code/Magento/Checkout/view/frontend/web/js/sidebar.js
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@ define([

if (msg) {
alert({
content: $.mage.__(msg)
content: msg
});
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,9 +70,7 @@ define([
'qty': ':input.cart-item-qty',
'button': ':button.update-cart-item'
},
'confirmMessage': $.mage.__(
'Are you sure you would like to remove this item from the shopping cart?'
)
'confirmMessage': $.mage.__('Are you sure you would like to remove this item from the shopping cart?')
});
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@ require([
'jquery',
'mage/template',
'jquery/file-uploader',
'domReady!'
'domReady!',
'mage/translate'
], function ($, mageTemplate) {
$('#<?php echo $block->getHtmlId() ?> .fileupload').fileupload({
dataType: 'json',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ define([
'jquery',
'Magento_Ui/js/core/app',
'underscore',
'notification'
'notification',
'mage/translate'
], function (Component, $, bootstrap, _) {
'use strict';

Expand Down Expand Up @@ -221,9 +222,7 @@ define([

if (data.items.length) {
this.productsModal.notification('add', {
message: $.mage.__(
'Choose a new product to delete and replace the current product configuration.'
),
message: $.mage.__('Choose a new product to delete and replace the current product configuration.'),
messageContainer: this.gridSelector
});
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,13 @@ define([
this.setNotificationMessage();
},
setNotificationMessage: function () {
/*eslint-disable max-len*/
var msg = $.mage.__('When you remove or add an attribute, we automatically update all configurations and you will need to recreate current configurations manually.');

/*eslint-enable max-len*/

if (this.mode === 'edit') {
this.wizard.setNotificationMessage($.mage.__('When you remove or add an attribute, we automatically ' +
'update all configurations and you will need to recreate current configurations manually.'));
this.wizard.setNotificationMessage(msg);
}
},
doSelectSavedAttributes: function () {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,8 @@ require([
'mage/template',
'jquery/file-uploader',
'mage/mage',
'prototype'
'prototype',
'mage/translate'
], function(jQuery, registry, mageTemplate){
registry.get('downloadable', function (Downloadable) {
var linkTemplate = '<tr>'+
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,8 @@ require([
'uiRegistry',
'mage/template',
'jquery/file-uploader',
'prototype'
'prototype',
'mage/translate'
], function (jQuery, registry, mageTemplate) {
registry.get('downloadable', function (Downloadable) {
var sampleTemplate = '<tr>'+
Expand Down
2 changes: 1 addition & 1 deletion app/code/Magento/Paypal/view/frontend/web/order-review.js
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ define([
}
}
alert({
content: $.mage.__(msg)
content: msg
});
return false;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
define([
'jquery',
'Magento_Ui/js/modal/alert',
'jquery/ui'
'jquery/ui',
'mage/translate'
], function ($, alert) {
'use strict';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
* See COPYING.txt for license details.
*/
require([
'jquery'
'jquery',
'mage/translate'
], function ($) {
'use strict';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,8 @@ require([
'jquery',
'mage/template',
'jquery/file-uploader',
'domReady!'
'domReady!',
'mage/translate'
], function ($, mageTemplate) {

$('#fileupload').fileupload({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ define([
'jquery',
'mage/template',
'text!Magento_Ui/templates/grid/cells/thumbnail/preview.html',
'Magento_Ui/js/modal/modal'
'Magento_Ui/js/modal/modal',
'mage/translate'
], function (Column, $, mageTemplate, thumbnailPreviewTemplate) {
'use strict';

Expand Down
20 changes: 11 additions & 9 deletions app/code/Magento/Ui/view/base/web/js/lib/validation/rules.js
Original file line number Diff line number Diff line change
Expand Up @@ -430,10 +430,10 @@ define([
var pass = $.trim(v);
var result = pass.length >= passwordMinLength;
if (result == false) {
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);
/*eslint-disable max-len*/
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);

/*eslint-enable max-len*/
return result;
}
if (pass.match(/\d+/)) {
Expand All @@ -450,10 +450,11 @@ define([
}
if (counter < passwordMinCharacterSets) {
result = false;
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);

/*eslint-disable max-len*/
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);

/*eslint-enable max-len*/
}
return result;
}, function () {
Expand Down Expand Up @@ -741,7 +742,8 @@ define([
}
}
return true;
}, "Please enter valid email addresses, separated by commas. For example, [email protected], [email protected]."
},
$.mage.__('Please enter valid email addresses, separated by commas. For example, [email protected], [email protected].')
],
"validate-cc-number": [
/**
Expand Down
19 changes: 10 additions & 9 deletions lib/web/mage/validation.js
Original file line number Diff line number Diff line change
Expand Up @@ -545,10 +545,10 @@
var pass = $.trim(v);
var result = pass.length >= passwordMinLength;
if (result == false) {
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);
/*eslint-disable max-len*/
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);

/*eslint-enable max-len*/
return result;
}
if (pass.match(/\d+/)) {
Expand All @@ -565,10 +565,11 @@
}
if (counter < passwordMinCharacterSets) {
result = false;
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);

/*eslint-disable max-len*/
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);

/*eslint-enable max-len*/
}
return result;
}, function () {
Expand Down Expand Up @@ -983,7 +984,7 @@

return !!container.querySelectorAll(selector).length;
},
'Please select one of the options.'
$.mage.__('Please select one of the options.')
],
"less-than-equals-to": [
function (value, element, params) {
Expand Down