Support and Documentation

Location of resource bundles

You can use resource bundles along with various template helpers to display localized or conditional text in published content. When creating a resource bundle, use the following conventions:

  1. Change to the directory containing the template you want to populate with a resource bundle.

  2. Create or open the file <TemplateName>, where xx is the code of the target language. For example, the file populates the template Author.hbs for English-language locales. (You need to add the target language's code even if you are not localizing the template's output.) For a list of two-letter language codes, see Codes for the Representation of Names of Languages.

  3. In the properties file, add lines of the form key=value.

The following illustration shows a typical example of a template with three resource bundles: one for English, French, and Spanish.

. └── styleguide/ └── author/ ├── AuthorPage.hbs ├── AuthorPage.json ├── ├── └──

At runtime, Brightspot uses the following logic to evaluate a template's {{format}} placeholders using resource bundles:

  1. Extract the site from the received URL.

  2. Determine the site's locale.

  3. Retrieve the template for the requested item.

  4. Look up the properties file for the site's locale.

  5. Within the properties file, look up the string to evaluate and return.

  6. Populate the template's helpers using the standard view-model logic.