Tip: How to add new strings when using translations

fileeefileee Member
The documentation explains how to translate existing strings, however, if you want to introduce new elements with new strings, then you need to not only add this to your translated json, but also add this to the english language object. How to do this? Do this:

Just add the following code BEFORE your custom language inclusion snippet (which you include on cart, checkout, receipt... etc. - see documentation)

{% set config = config|merge({'lang': config.lang|merge(
'my_new_custom_string': 'This is the english translation',
'my_new_custom_string2': 'This is another english translation',
})}) %}

{% set custom_lang = {
"DE": {
'my_new_custom_string': 'This is the german translation',
'my_new_custom_string2': 'This is another german translation',
} %}

Sign In or Register to comment.