Cert++
Close

Locale-specific template folders and lookup

Key Takeaway

B2C Commerce looks for a template first in the folder for the full request locale (such as de_AT), then in the folder for its language (de), then in default. Keep shared templates in default, and put a copy in a locale folder only for templates that differ for that locale.

B2C Commerce stores ISML templates in locale-named folders under each cartridge's templates directory, so a page can render from a different template for each locale. For each request, B2C Commerce uses the request's locale to find a matching template. When no locale-specific template exists, B2C Commerce falls back to the default folder. Salesforce recommends one shared template set with translated text in properties files, so keep locale folders for templates that truly must differ.

Where templates live

ISML templates are *.isml files stored in locale-specific folders under /cartridge/templates/. Each cartridge has its own templates directory. The /cartridge/templates/default folder holds the default locale. Each supported locale needs its own subdirectory under /templates/, called a locale folder.

/cartridge/templates/
    default/
        account/login.isml
        checkout/cart.isml
        home/homepage.isml
    de/
        home/homepage.isml
    de_AT/
        checkout/cart.isml

The structure is templates/{locale_folder}/{template_files}. Every template must sit inside a subdirectory of templates, either default or a locale folder. A template stored directly in the templates directory itself is not allowed. Inside a locale folder, you can add subdirectories organized by area of functionality, such as account, checkout and home in the tree above.

B2C Commerce Developer Study Guide

Checklist progress

0/237Learned

Given localization requirements, implement and enhance templates, form definitions, static files, properties files, and persistent object attributes to ensure that pages are displayed in the expected language

0/8

Prepare for the Exam

Play Today's Certle

Study Community

Ask questions and get the latest info from other B2C Commerce Developer studiers. 796 members and growing.