I18n SFO

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

Field

Type

Comment/Sample

Methods

Method

Returns

Parameters

Parameter Types

Comment/Sample

Method

Returns

Parameters

Parameter Types

Comment/Sample

escape

string

input

boolean

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

escape

string

input

string

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

getCurrencies

I18NCurrency[]

 

 

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[]

countryCode

string

Given a two letter ISO country code, return the languages that are popular that country. Used by the language picker.

getUnpopularLanguages()

I18NLanguage[]

countryCode

string

Given a two letter ISO country code, return back all the languages that are considered unpopular for a country. Used by the language picker.

getIsoCode

string

 

 

returns back the current ISO Code for the page. Default is ENG.

getJavaScriptHash

string

 

 

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.

htmlLang

string

key

string

Generates 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.

ignoreHtmlLang

void

key

string

Registers 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.

isGoogleTranslateUsed

boolean

 

 

Returns true if any text on the page was automatically translated by Google Translate. Used for displaying the attribution mark in the footer.

newlineToBreaks

string

input

string

Takes a block of text and converts all newlines to <br> tags so that the text remains consistent rendered in html.

pushJavaScriptHash

void

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.

write

string

defaultMessage

string

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.

write

string

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

write

string

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

write

string

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.

write

string

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