Using Template Resource Files For Labels in Commerce Cloud

It’s good practice to parameterize labels, rather than hard-coding them, so that they can localized easily. In SFCC, you define your labels in .properties files, and you can create separate files for each locale.

In this post, assume that your cartridge is called int_mycartridge. You would create your .properties file(s) in int_mycartridge/templates/resources:


You can have more than one .properties file. The file naming convention for different locales is as follows:

  • Default locale file
  • Localization file for all Spanish (ES) locales
  • Localization file for the es_ES (Spanish-Spain) locale

The file will look something like this, with one entry per line:

field.shipping.address.rut=Rol Unico Tributario

You can use your judgment as to the dot syntax – in the example above, which is for a checkout form, I followed the same pattern as other checkout fields.

Then, in either your ISML templates, you can reference the labels as follows:

    ${Resource.msg('field.shipping.address.rut', 'my_resource_file', 'Rol Unico Tributario')}:

Note that uses the Resource class. The second argument is the name of your .properties file (without the extension), and the third is the default text to show if the label couldn’t be found.

If you’re using SFRA’s declarative XML to define a form, complete with validation, then you will want to reference error messages in the definition XML, e.g.

<?xml version="1.0"?>
<form xmlns="">
    <field formid="regionCode" type="string" mandatory="true" 


Note how this XML file references labels such as form.mycartridge.label.region. In this case, you simply need to define a resource file named for the framework to locate your labels.

Leave a Reply

Your email address will not be published. Required fields are marked *