I18n SFO

Basic Example Usage:

<div class="ucColorSubHeader">$i18n.write("checkout.viewcart.yourContactEmailField", "Your contact email")</div>
See Also: How StoreFront handles static text and multi-lingual support

Properties

Field

Type

Comment/Sample

Methods

Method

Returns

Parameters

Parameter Types

Comment/Sample

escapestringinputbooleanReturns the text "true" or "false" based upon the boolean input parameter.
escapestringinputstring

Takes a block of text and html escapes it so it can be safely added to a web page without causing harm.

Example:

#foreach($error in $formSupport.errors)
   #if($error.alreadyEscaped)$!error.message#{else}$i18n.escape($error.message)#{end}<br>
#end
getCurrenciesI18NCurrency[]  Returns back a list of supported currencies. The names of the currencies are translated into the language that the customer is using.
getLanguages()I18NLanguage[]  Returns back a list of support languages. The languages are each translated into the native way the language is spelled. Used by the language picker.
getPopularLanguages()I18NLanguage[]countryCodestringGiven a two letter ISO country code, return the languages that are popular that country. Used by the language picker.
getUnpopularLanguages()I18NLanguage[]countryCodestringGiven a two letter ISO country code, return back all the languages that are considered unpopular for a country. Used by the language picker.
getIsoCodestring  returns back the current ISO Code for the page. Default is ENG.
getJavaScriptHashstring  returns a JavaScript has object created by all the calls to pushJavaScriptHash. These two methods work together to create a hash map of translated text used by dynamic elements on the page, such as the cart snapshot, which still need to display translated content.
htmlLangstringkeystringGenerates the lang attribute associated with this key. The lang attribute is used to identify what type of translation has occurred for a given element and is required by Google when auto translation is used.
ignoreHtmlLangvoidkeystringRegisters that we want to ignore outputting an htmlLang call for a given key. Prevents an i18n violation from being generated. Also registers the key for use by a subsequent shorthand write call.
isGoogleTranslateUsedboolean  Returns true if any text on the page was automatically translated by Google Translate. Used for displaying the attribution mark in the footer.
newlineToBreaksstringinputstringTakes a block of text and converts all newlines to <br> tags so that the text remains consistent rendered in html.
pushJavaScriptHashvoid

key

defaultText

args..

string

string

string... 

This method is similar to a write call, but will queue up the entry which is returned by getJavaScriptHash.
writestringdefaultMessagestringThe key associated with this write call is the one last used on an htmlLang or ignoreHtmlLang call. It enables a shorter syntax in the template.
writestring

defaultMessage

escape

string

boolean

The key associated with this write call is the one last used on an htmlLang or ignoreHtmlLang call. It enables a shorter syntax in the template.

if true, the return value is html escaped first

writestring

key

defaultMessage

string

string

key is the full dot separated path to the message key as found in the language file. Example: checkout.accessaccount.emailField

If the key isn't found, this default is used instead

writestring

key

defaultMessage

args...

string

string

string... 

key is the full dot separated path to the message key as found in the language file. Example: checkout.accessaccount.emailField

If the key isn't found, this default is used instead

Arguments to merge into the message. {0} = first argument place holder, {1} = second argument place holder, etc.

writestring

key

defaultMessage

escape

string

string

boolean

key is the full dot separated path to the message key as found in the language file. Example: checkout.accessaccount.emailField

If the key isn't found, this default is used instead

if true, the return value is html escaped first

See Also