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

fix(storefront): BCTHEME-535 Translation Gap: Cart -> Shipping estimator error messages. #2066

Merged
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# Changelog

## Draft
- Translation Gap: Cart -> Shipping estimator error messages. [#2066](https://github.com/bigcommerce/cornerstone/pull/2066)
- Added settings for payment banners. [#2021](https://github.com/bigcommerce/cornerstone/pull/2021)
- Use https:// for schema markup. [#2039](https://github.com/bigcommerce/cornerstone/pull/2039)
- Update focus tooltip styles contrast to achieve accessibility AA Complaince. [#2047](https://github.com/bigcommerce/cornerstone/pull/2047)
Expand Down
6 changes: 5 additions & 1 deletion assets/js/theme/cart.js
Original file line number Diff line number Diff line change
Expand Up @@ -456,6 +456,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);
}
}
7 changes: 4 additions & 3 deletions assets/js/theme/cart/shipping-estimator.js
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down Expand Up @@ -63,7 +64,7 @@ export default class ShippingEstimator {

cb(result);
},
errorMessage: 'The \'Country\' field cannot be blank.',
errorMessage: this.shippingErrorMessages.country
},
]);
}
Expand All @@ -85,7 +86,7 @@ export default class ShippingEstimator {

cb(result);
},
errorMessage: 'The \'State/Province\' field cannot be blank.',
errorMessage: this.shippingErrorMessages.province
},
]);
}
Expand Down
4 changes: 3 additions & 1 deletion lang/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
3 changes: 3 additions & 0 deletions templates/components/cart/shipping-estimator.html
Original file line number Diff line number Diff line change
@@ -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}}
<div class="cart-total-value">
<div class="subtotal shipping-estimate-show">
Expand Down