Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

 

Include Page
Theme Multi-Lingual Support
Theme Multi-Lingual Support

 

Directions for editing a language file

Include Page
Changing Checkout Text
Changing Checkout Text

Static Text

If you edit a template you may be tempted to just place static text into the template.  For example you are putting in a title div into the document like this:

...

If you enter text directly like this into the template, it will generate an i18n (internationalization) violation.  An i18n violation means there is a piece of text that the system can not automatically translate when the customer is browsing in a different language.  To get around this problem, the text is passed through the i18n system so that it can be tracked and translated.  To do this, use the the $i18n object  object by calling $i18n.write like the example below.

<div div class="ucColorSubHeader">$i18n.write("checkout.viewcart.yourContactEmailField", "Your contact email")</div>

...

<div class="ucColorSubHeader" $!{i18n.htmlLang("checkout.viewcart.yourContactEmailField")}>${i18n.write("Your contact email")}</div>

There are a couple of important things to point out about this coding change.  First off the call to htmlLang will produce a complete lang attribute tag for the element if necessary.  If not it will produce nothing.  The exclamation point after the dollar sign in that call instructs Velocity to output nothing if the result of the function call is null.  It is best practice to include that in the call.  The second thing to notice is that the write call now has a single parameter which is the default text.  When write is called with a single parameter, it knows to use the key from the previous htmlLang function call.  This shortens the amount of code that has to go into the template in order to achieve compliant HTML translation capabilities.  

 

...

 

Directions for editing a language file

...