Using One Template Set to Localize

The Storefront Reference Architecture (SFRA) application provides a simple way to localize any text that appears in the storefront. It uses a single template set for all locales, stored in properties files (called template resource bundles). The template resource bundles are translated, not the templates. The templates reference the localizable text in the template resource bundles by keys. Depending on the locale that is used in the storefront, a different translation (localization) of the properties file is used.

Projects typically start from the SFRA application code, so it's important that you use this approach consistently.

Directory Structure

To support multiple languages, you can create language-specific (for example, en) or locale-specific (for example, en_US) directories within the templates/resources directory, as follows:

/templates
	/default
		/account.isml
		...
		/util.isml
	/resources
		account.properties - default files
		...
		storelocator.properties
		/fr
			account.properties
			...
			storelocator.properties
		/de
		account.properties
			...
			storelocator.properties

Salesforce B2C Commerce (and the SFRA application) supports a localization fall-back mechanism. If no locale-specific directory exists, the language-specific directory is used. If there is no language-specific directory, the default directory is used.

There is a corresponding template resource bundle for each folder in the templates directory and one for the forms definitions.