diff --git a/CHANGELOG.md b/CHANGELOG.md index a47880b8a3..e956bed078 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,7 @@ # Changelog ## Draft +- Translation Gap: Cart -> Shipping estimator error messages. [#2066](https://github.com/bigcommerce/cornerstone/pull/2066) - Add to cart button and Wishlist should be on one line on desktop. [#2050](https://github.com/bigcommerce/cornerstone/pull/2050) - Logo on AMP Product details page (PDP) doesn't fit header. [#2054](https://github.com/bigcommerce/cornerstone/pull/2054) - Translation Gap: Compare page fields (Description, Rating and Availability). [#2059](https://github.com/bigcommerce/cornerstone/pull/2059) diff --git a/assets/js/theme/cart.js b/assets/js/theme/cart.js index a08e11dc31..14062cd176 100644 --- a/assets/js/theme/cart.js +++ b/assets/js/theme/cart.js @@ -457,6 +457,10 @@ export default class Cart extends PageManager { this.bindGiftCertificateEvents(); // initiate shipping estimator module - this.shippingEstimator = new ShippingEstimator($('[data-shipping-estimator]')); + const shippingErrorMessages = { + country: this.context.shippingCountryErrorMessage, + province: this.context.shippingProvinceErrorMessage + } + this.shippingEstimator = new ShippingEstimator($('[data-shipping-estimator]'), shippingErrorMessages); } } diff --git a/assets/js/theme/cart/shipping-estimator.js b/assets/js/theme/cart/shipping-estimator.js index 8be324d460..22ddeb9134 100644 --- a/assets/js/theme/cart/shipping-estimator.js +++ b/assets/js/theme/cart/shipping-estimator.js @@ -6,11 +6,12 @@ import collapsibleFactory from '../common/collapsible'; import swal from '../global/sweet-alert'; export default class ShippingEstimator { - constructor($element) { + constructor($element, shippingErrorMessages) { this.$element = $element; this.$state = $('[data-field-type="State"]', this.$element); this.isEstimatorFormOpened = false; + this.shippingErrorMessages = shippingErrorMessages; this.initFormValidation(); this.bindStateCountryChange(); this.bindEstimatorEvents(); @@ -63,7 +64,7 @@ export default class ShippingEstimator { cb(result); }, - errorMessage: 'The \'Country\' field cannot be blank.', + errorMessage: this.shippingErrorMessages.country }, ]); } @@ -85,7 +86,7 @@ export default class ShippingEstimator { cb(result); }, - errorMessage: 'The \'State/Province\' field cannot be blank.', + errorMessage: this.shippingErrorMessages.province }, ]); } diff --git a/lang/en.json b/lang/en.json index 8a9dcab892..c2556b8058 100755 --- a/lang/en.json +++ b/lang/en.json @@ -105,7 +105,9 @@ "zip_postal_code": "Zip/postcode", "free_shipping": "Free shipping", "hide_ups_rates": "Hide UPS Rates", - "show_ups_rates": "Show UPS Rates" + "show_ups_rates": "Show UPS Rates", + "empty_country_error": "The Country field cannot be blank.", + "empty_province_error": "The State/Province field cannot be blank." }, "gift_wrapping": { "title": "Gift Wrapping", diff --git a/templates/components/cart/shipping-estimator.html b/templates/components/cart/shipping-estimator.html index d07217747d..e1b98c2f27 100644 --- a/templates/components/cart/shipping-estimator.html +++ b/templates/components/cart/shipping-estimator.html @@ -1,3 +1,6 @@ +{{inject 'shippingCountryErrorMessage' (lang 'cart.shipping_estimator.empty_country_error')}} +{{inject 'shippingProvinceErrorMessage' (lang 'cart.shipping_estimator.empty_province_error')}} + {{#if shipping_cost}}