Getting Started
About Stencil
Transitioning to Stencil
Installing Stencil
Authentication & Tokens
Running Stencil Locally
Advanced Installation Options
Template Files
Templates Directory
Custom Templates
Customize Stencil Checkout
Handlebars and Stencil
Handlebars Helpers
Stencil Object Model
Stencil Objects

Features Supported

Automatic Language Detection

The Stencil framework can automatically detect a localized language, based on the active shopper’s "Accept‑Language" header.

Cascading Translations

Cascading works as follows: Assume that a Quebec/French-Canadian customer visits a storefront built with both fr.json and fr‑CA.json localization files. The framework places the fr‑CA locale “on top of” the base fr locale. Therefore, any strings missing from the fr‑CA.json file will “fall back” to definitions in the base fr.json file, providing at least approximate translations. This cascading works generally across languages and locales.

Nested Plurality and Gender Support

The framework allows you to code conditional plurality for strings within each translation file. For example, your code within an English-language file could overload a single message to display in each of the following forms – depending on the actual value of its two numeric variables:

  • “There are 3 items in 2 categories”
  • “There is 1 item in 2 categories”
  • “There are 2 items in 1 category”

Here is the markup that would handle the first three words in each example above, assuming appropriate parameters were inserted in the translation files:

<h2 class="modal-header-title">
   {{lang 'cart.added_to_cart.what_next' num_products=cart.quantity}} [...]

Similarly, the framework supports per-language conditional coding of appropriate genders for pronouns and nouns.