diff --git a/assets/ajax-cart.js.liquid b/assets/ajax-cart.js.liquid index 07d2c7a6f..f5b3c3b58 100644 --- a/assets/ajax-cart.js.liquid +++ b/assets/ajax-cart.js.liquid @@ -288,7 +288,7 @@ var ajaxCart = (function(module, $) { // Show empty cart if (cart.item_count === 0) { $cartContainer - .append('
' + {{ 'cart.general.empty' | t | json }} + '
'); + .append('' + I18n['cart.general.empty'] + '
'); cartCallback(cart); return; } @@ -343,7 +343,7 @@ var ajaxCart = (function(module, $) { items: items, note: cart.note, totalPrice: Shopify.formatMoney(cart.total_price, settings.moneyFormat), - totalCartDiscount: cart.total_discount === 0 ? 0 : {{ 'cart.general.savings_html' | t: price: '[savings]' | json }}.replace('[savings]', Shopify.formatMoney(cart.total_discount, settings.moneyFormat)), + totalCartDiscount: cart.total_discount === 0 ? 0 : I18n['cart.general.savings_html'].replace('[savings]', Shopify.formatMoney(cart.total_discount, settings.moneyFormat)), totalCartDiscountApplied: cart.total_discount === 0 ? false : true } diff --git a/assets/timber.js.liquid b/assets/timber.js.liquid index 767a67efe..0365b6b81 100755 --- a/assets/timber.js.liquid +++ b/assets/timber.js.liquid @@ -183,11 +183,11 @@ timber.accessibleNav = function () { timber.drawersInit = function () { timber.LeftDrawer = new timber.Drawers('NavDrawer', 'left'); - {% if settings.ajax_cart_method == "drawer" %} + if (timber.settings.ajax_cart_method == "drawer") { timber.RightDrawer = new timber.Drawers('CartDrawer', 'right', { 'onDrawerOpen': ajaxCart.load }); - {% endif %} + } }; timber.mobileNavToggle = function () { @@ -226,12 +226,12 @@ timber.productPage = function (options) { if (variant.available) { // Available, enable the submit button, change text, show quantity elements $addToCart.removeClass('disabled').prop('disabled', false); - $addToCartText.html({{ 'products.product.add_to_cart' | t | json }}); + $addToCartText.html(I18n['products.product.add_to_cart']); $quantityElements.show(); } else { // Sold out, disable the submit button, change text, hide quantity elements $addToCart.addClass('disabled').prop('disabled', true); - $addToCartText.html({{ 'products.product.sold_out' | t | json }}); + $addToCartText.html(I18n['products.product.sold_out']); $quantityElements.hide(); } @@ -241,7 +241,7 @@ timber.productPage = function (options) { // Also update and show the product's compare price if necessary if (variant.compare_at_price > variant.price) { $comparePrice - .html({{ 'products.product.compare_at' | t | json }} + ' ' + Shopify.formatMoney(variant.compare_at_price, moneyFormat)) + .html(I18n['products.product.compare_at'] + ' ' + Shopify.formatMoney(variant.compare_at_price, moneyFormat)) .show(); } else { $comparePrice.hide(); @@ -253,7 +253,7 @@ timber.productPage = function (options) { // To only show available variants, implement linked product options: // - http://docs.shopify.com/manual/configuration/store-customization/advanced-navigation/linked-product-options $addToCart.addClass('disabled').prop('disabled', true); - $addToCartText.html({{ 'products.product.unavailable' | t | json }}); + $addToCartText.html(I18n['products.product.unavailable']); $quantityElements.hide(); } }; diff --git a/layout/theme.liquid b/layout/theme.liquid index 6191090cc..09893a643 100755 --- a/layout/theme.liquid +++ b/layout/theme.liquid @@ -393,6 +393,8 @@ {{ 'fastclick.min.js' | asset_url | script_tag }} + {% include 'timber-js-locales' %} + {{ 'timber.js' | asset_url | script_tag }} {% comment %} @@ -414,6 +416,7 @@ {% if settings.ajax_cart_method == "drawer" %} {{ 'handlebars.min.js' | asset_url | script_tag }} {% include 'ajax-cart-template' %} + {% include 'ajax-cart-locales' %} {{ 'ajax-cart.js' | asset_url | script_tag }} diff --git a/snippets/timber-js-locales.liquid b/snippets/timber-js-locales.liquid new file mode 100644 index 000000000..cfd77793c --- /dev/null +++ b/snippets/timber-js-locales.liquid @@ -0,0 +1,7 @@ +