Handlebars Syntax and Helpers
Handlebars.js
Handlebars Helpers
Stencil Object Model
Stencil Objects

Multi Language Checkout

Multi-Language Setup

In Stencil’s default Cornerstone theme, both the Optimized One-Page Checkout and the order confirmation pages contain Handlebars abstracted {{lang}} statements to facilitate automatic translation into different locales’ natural languages.

In the default checkout page template (located at <theme-name>/templates/pages/checkout.html), one example that you can directly view is the page header:

<h1 class="is-srOnly">{{lang 'checkout.title'}}

These {{lang}} statements, like the example above, enable automatic rendering of their parameters into languages that shoppers have selected in their browser preferences.


Browsing Hidden Translation Keys

BigCommerce exposes only part of the checkout page’s structure through the local template referenced above. For security purposes – and also to offer all stores new checkout features simultaneously – most checkout content is hidden.

This hidden content includes many more key/value pairs that support translation. However, you can see all the available keys with their default English-language values in Cornerstone’s en.json file


Adding Your Own Translation Values

You can provide values for all of checkout’s supported translation keys – for all the languages you want to support – even without direct access to the hidden parts of the checkout template. Here is how:

  1. Download and unzip a local copy of the sample file linked above.

  2. Copy the file’s entire contents to your clipboard:

{
 "optimized_checkout": {
     "address": {
         "address_line_1_label": "Address Line 1",
         "address_line_1_required_error": "Address Line 1 is required",
         "address_line_2_label": "Address Line 2",
         "address_line_2_required_error": "Address Line 1 is required",
         "address_not_recognized_heading": "We did not recognize your address",
         "city_label": "City",
         [...]
         "order_without_support_number_text": "An email will be sent containing information about your purchase. If you have any questions about your purchase, email us at <a ng-href=\"mailto:{supportEmail}?Subject=Order {orderNumber}\" target=\"_top\">{supportEmail}</a>.",
         "thank_you_customer_heading": "Thank you {name}!",
         "thank_you_heading": "Thank you!",
         "order_status_update_facebook_messenger_heading": "Get instant updates of your order to Messenger"
     }
 }
}
  1. Paste this whole optimized_checkout JSON block into your theme’s en.json file, and into an xx.json file for each language into which you want to translate your checkout page’s text. (To see requirements for naming and deploying these translation files, please this documentation’s Internationalization section.)

  2. Replace the keys’ values with appropriate phrases in each file’s target language.

Localized Country and State Names

In the Optimized One-Page Checkout page’s Shipping Address and Billing Address fields, BigCommerce currently provides automatic translation of drop-down lists’ displayed Country and State names into 12 supported languages. Here are the steps for enabling this translation:

  1. As for the translation options described above, you must enable Optimized One-Page Checkout.

  2. Within your <theme-name>/lang/ subdirectory, you must provide a xx.json file with the appropriate two-letter prefix for one or more of the Supported Languages in the Naming Requirements table below. (The naming conventions we follow are explained on this page.)

  3. We recommend that you populate that file with the checkout-specific keys/values covered above at Adding Your Own Translation Values. This is not strictly necessary to translate the drop-down lists, but it is necessary to provide a consistent translation of the surrounding Address sections. You do not need to provide any keys/values for the Country/State names, whose translations are predefined within the BigCommerce platform.

  4. As with the translation options described above, the storefront will automatically display the translated Country/State names to visitors who have selected one of the supported languages in their browser’s locale preferences.

Country/State Translation – Naming Requirements

BigCommerce Optimized One-Page Checkout will currently translate displayed Country/State names if your Stencil theme includes .../lang/xx.json files named as shown below.

Supported Language Required Translation File Name
German de.json
Spanish es.json
French fr.json
Hindi hi.json
Italian it.json
Japanese ja.json
Korean ko.json
Dutch nl.json
Punjabi pa.json
Tamil ta.json
Chinese Simplified zh-TW.json
Chinese Traditional zh.json

Stencil’s Overall Limits on Translation

  • Your theme’s content will translate only to the extent that you have created JSON files in your <theme-name>/lang/ subdirectory for each language that you choose to support, and have included key/value pairs for the parameters (beyond Country/State) that you choose to translate.

  • Stencil’s multi-language capabilities are currently limited to these specific strings that you specify within the theme. The Stencil framework does not currently translate content rendered from a store’s database – for example, products’ names.

  • Within these limitations, if you intend to do business internationally, we recommend that you specify appropriate alternate-language strings for key parts of your storefront, product catalog, and checkout. Doing so will make browsing, purchasing, and payment easier for users in your target market(s). For an overview of all localization options, please see Localizing Stores.