From 2c9d082dc4bf03920e30b703b1674b8ae8844257 Mon Sep 17 00:00:00 2001 From: Olga Lytvynenko Date: Tue, 20 Sep 2016 14:03:03 +0300 Subject: [PATCH] Backport of MAGETWO-55900 for Magento 2.1: [GitHub] Translate messages on password strength #5509 #5883 #5861 (cherry picked from commit f67e5989f5efb36ca331e5cc28ee109961fcb99c) Not included validation messages from https://github.com/magento/magento2/commit/6ce2b5fcbddb5584a4bc3e454d90e2295da4f4ff (MAGETWO-42994) --- .../web/catalog/product-attributes.js | 3 ++- .../web/component/image-size-field.js | 3 ++- .../frontend/web/js/view/compare-products.js | 20 +++++++++---------- .../Checkout/view/frontend/web/js/sidebar.js | 2 +- .../view/frontend/web/js/view/minicart.js | 4 +--- .../templates/browser/content/uploader.phtml | 3 ++- .../web/js/variations/product-grid.js | 7 +++---- .../js/variations/steps/select_attributes.js | 8 ++++++-- .../product/edit/downloadable/links.phtml | 3 ++- .../product/edit/downloadable/samples.phtml | 3 ++- .../Paypal/view/frontend/web/order-review.js | 2 +- .../adminhtml/web/js/get-video-information.js | 3 ++- .../view/adminhtml/web/js/type-change.js | 3 ++- .../templates/browser/content/uploader.phtml | 3 ++- .../base/web/js/grid/columns/thumbnail.js | 3 ++- .../view/base/web/js/lib/validation/rules.js | 20 ++++++++++--------- lib/web/mage/validation.js | 19 +++++++++--------- 17 files changed, 61 insertions(+), 48 deletions(-) diff --git a/app/code/Magento/Catalog/view/adminhtml/web/catalog/product-attributes.js b/app/code/Magento/Catalog/view/adminhtml/web/catalog/product-attributes.js index 4df5af1fba8e8..78f48b0bafabb 100644 --- a/app/code/Magento/Catalog/view/adminhtml/web/catalog/product-attributes.js +++ b/app/code/Magento/Catalog/view/adminhtml/web/catalog/product-attributes.js @@ -6,7 +6,8 @@ define([ 'jquery', 'underscore', 'uiRegistry', - 'jquery/ui' + 'jquery/ui', + 'mage/translate' ], function ($, _, registry) { 'use strict'; diff --git a/app/code/Magento/Catalog/view/adminhtml/web/component/image-size-field.js b/app/code/Magento/Catalog/view/adminhtml/web/component/image-size-field.js index db4fe46a3515e..cbb16b397f9e6 100644 --- a/app/code/Magento/Catalog/view/adminhtml/web/component/image-size-field.js +++ b/app/code/Magento/Catalog/view/adminhtml/web/component/image-size-field.js @@ -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'; diff --git a/app/code/Magento/Catalog/view/frontend/web/js/view/compare-products.js b/app/code/Magento/Catalog/view/frontend/web/js/view/compare-products.js index 02209e904f22c..be7793e7ebaf7 100644 --- a/app/code/Magento/Catalog/view/frontend/web/js/view/compare-products.js +++ b/app/code/Magento/Catalog/view/frontend/web/js/view/compare-products.js @@ -4,7 +4,8 @@ */ define([ 'uiComponent', - 'Magento_Customer/js/customer-data' + 'Magento_Customer/js/customer-data', + 'mage/translate' ], function (Component, customerData) { 'use strict'; @@ -12,23 +13,22 @@ define([ 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*/ }); } diff --git a/app/code/Magento/Checkout/view/frontend/web/js/sidebar.js b/app/code/Magento/Checkout/view/frontend/web/js/sidebar.js index aebf4ed3d6530..29e9e2ea896ec 100644 --- a/app/code/Magento/Checkout/view/frontend/web/js/sidebar.js +++ b/app/code/Magento/Checkout/view/frontend/web/js/sidebar.js @@ -224,7 +224,7 @@ define([ if (msg) { alert({ - content: $.mage.__(msg) + content: msg }); } } diff --git a/app/code/Magento/Checkout/view/frontend/web/js/view/minicart.js b/app/code/Magento/Checkout/view/frontend/web/js/view/minicart.js index 8d54413581631..7a25538bcc01a 100644 --- a/app/code/Magento/Checkout/view/frontend/web/js/view/minicart.js +++ b/app/code/Magento/Checkout/view/frontend/web/js/view/minicart.js @@ -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?') }); } diff --git a/app/code/Magento/Cms/view/adminhtml/templates/browser/content/uploader.phtml b/app/code/Magento/Cms/view/adminhtml/templates/browser/content/uploader.phtml index e01d39f03771d..ef3e449fe52db 100644 --- a/app/code/Magento/Cms/view/adminhtml/templates/browser/content/uploader.phtml +++ b/app/code/Magento/Cms/view/adminhtml/templates/browser/content/uploader.phtml @@ -29,7 +29,8 @@ require([ 'jquery', 'mage/template', 'jquery/file-uploader', - 'domReady!' + 'domReady!', + 'mage/translate' ], function ($, mageTemplate) { $('#getHtmlId() ?> .fileupload').fileupload({ dataType: 'json', diff --git a/app/code/Magento/ConfigurableProduct/view/adminhtml/web/js/variations/product-grid.js b/app/code/Magento/ConfigurableProduct/view/adminhtml/web/js/variations/product-grid.js index d9aa420b6106b..ce2fd9ac5ea80 100644 --- a/app/code/Magento/ConfigurableProduct/view/adminhtml/web/js/variations/product-grid.js +++ b/app/code/Magento/ConfigurableProduct/view/adminhtml/web/js/variations/product-grid.js @@ -8,7 +8,8 @@ define([ 'jquery', 'Magento_Ui/js/core/app', 'underscore', - 'notification' + 'notification', + 'mage/translate' ], function (Component, $, bootstrap, _) { 'use strict'; @@ -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 { diff --git a/app/code/Magento/ConfigurableProduct/view/adminhtml/web/js/variations/steps/select_attributes.js b/app/code/Magento/ConfigurableProduct/view/adminhtml/web/js/variations/steps/select_attributes.js index 961e2ca23ed36..18a1b30c051ce 100644 --- a/app/code/Magento/ConfigurableProduct/view/adminhtml/web/js/variations/steps/select_attributes.js +++ b/app/code/Magento/ConfigurableProduct/view/adminhtml/web/js/variations/steps/select_attributes.js @@ -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 () { diff --git a/app/code/Magento/Downloadable/view/adminhtml/templates/product/edit/downloadable/links.phtml b/app/code/Magento/Downloadable/view/adminhtml/templates/product/edit/downloadable/links.phtml index 517b86c5c2831..073090ed8edf8 100644 --- a/app/code/Magento/Downloadable/view/adminhtml/templates/product/edit/downloadable/links.phtml +++ b/app/code/Magento/Downloadable/view/adminhtml/templates/product/edit/downloadable/links.phtml @@ -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 = ''+ diff --git a/app/code/Magento/Downloadable/view/adminhtml/templates/product/edit/downloadable/samples.phtml b/app/code/Magento/Downloadable/view/adminhtml/templates/product/edit/downloadable/samples.phtml index cfff227a99c7d..db3b3bf702471 100644 --- a/app/code/Magento/Downloadable/view/adminhtml/templates/product/edit/downloadable/samples.phtml +++ b/app/code/Magento/Downloadable/view/adminhtml/templates/product/edit/downloadable/samples.phtml @@ -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 = ''+ diff --git a/app/code/Magento/Paypal/view/frontend/web/order-review.js b/app/code/Magento/Paypal/view/frontend/web/order-review.js index 42b75472852c3..5e4d12ecf648f 100644 --- a/app/code/Magento/Paypal/view/frontend/web/order-review.js +++ b/app/code/Magento/Paypal/view/frontend/web/order-review.js @@ -132,7 +132,7 @@ define([ } } alert({ - content: $.mage.__(msg) + content: msg }); return false; } diff --git a/app/code/Magento/ProductVideo/view/adminhtml/web/js/get-video-information.js b/app/code/Magento/ProductVideo/view/adminhtml/web/js/get-video-information.js index 679a716a6e7d5..af4374c2c136a 100644 --- a/app/code/Magento/ProductVideo/view/adminhtml/web/js/get-video-information.js +++ b/app/code/Magento/ProductVideo/view/adminhtml/web/js/get-video-information.js @@ -6,7 +6,8 @@ define([ 'jquery', 'Magento_Ui/js/modal/alert', - 'jquery/ui' + 'jquery/ui', + 'mage/translate' ], function ($, alert) { 'use strict'; diff --git a/app/code/Magento/Swatches/view/adminhtml/web/js/type-change.js b/app/code/Magento/Swatches/view/adminhtml/web/js/type-change.js index d38ef5f87163d..adf30c500dadc 100644 --- a/app/code/Magento/Swatches/view/adminhtml/web/js/type-change.js +++ b/app/code/Magento/Swatches/view/adminhtml/web/js/type-change.js @@ -3,7 +3,8 @@ * See COPYING.txt for license details. */ require([ - 'jquery' + 'jquery', + 'mage/translate' ], function ($) { 'use strict'; diff --git a/app/code/Magento/Theme/view/adminhtml/templates/browser/content/uploader.phtml b/app/code/Magento/Theme/view/adminhtml/templates/browser/content/uploader.phtml index f08f4ac21bbb0..3f4b5a8785fa2 100644 --- a/app/code/Magento/Theme/view/adminhtml/templates/browser/content/uploader.phtml +++ b/app/code/Magento/Theme/view/adminhtml/templates/browser/content/uploader.phtml @@ -33,7 +33,8 @@ require([ 'jquery', 'mage/template', 'jquery/file-uploader', - 'domReady!' + 'domReady!', + 'mage/translate' ], function ($, mageTemplate) { $('#fileupload').fileupload({ diff --git a/app/code/Magento/Ui/view/base/web/js/grid/columns/thumbnail.js b/app/code/Magento/Ui/view/base/web/js/grid/columns/thumbnail.js index 796572b83fcb9..2c771c460bf91 100644 --- a/app/code/Magento/Ui/view/base/web/js/grid/columns/thumbnail.js +++ b/app/code/Magento/Ui/view/base/web/js/grid/columns/thumbnail.js @@ -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'; diff --git a/app/code/Magento/Ui/view/base/web/js/lib/validation/rules.js b/app/code/Magento/Ui/view/base/web/js/lib/validation/rules.js index 0337fcf541123..38cf168ad88b6 100644 --- a/app/code/Magento/Ui/view/base/web/js/lib/validation/rules.js +++ b/app/code/Magento/Ui/view/base/web/js/lib/validation/rules.js @@ -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+/)) { @@ -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 () { @@ -741,7 +742,8 @@ define([ } } return true; - }, "Please enter valid email addresses, separated by commas. For example, johndoe@domain.com, johnsmith@domain.com." + }, + $.mage.__('Please enter valid email addresses, separated by commas. For example, johndoe@domain.com, johnsmith@domain.com.') ], "validate-cc-number": [ /** diff --git a/lib/web/mage/validation.js b/lib/web/mage/validation.js index 9d57001b6d2dc..7ef8ec072d510 100644 --- a/lib/web/mage/validation.js +++ b/lib/web/mage/validation.js @@ -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+/)) { @@ -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 () { @@ -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) {