Properties Methods Events Direct Link

Class Granite.I18n

Package:Granite
Class:I18n
Extends:Object
Clientlib:<unknown> , *
A helper class providing a set of utilities related to internationalization (i18n).

Locale Priorities

The locale is read based on the following priorities:

  1. manually specified locale
  2. document.documentElement.lang
  3. Granite.I18n.LOCALE_DEFAULT

Dictionary Priorities

The dictionary URL is read based on the following priorities:

  1. manually specified URL (urlPrefixurlSuffix)
  2. data-i18n-dictionary-src attribute at <html> element, which has the type of URI Template string
  3. The URL resolved from default urlPrefix and urlSuffix

URI Template of data-i18n-dictionary-src

It expects the variable named locale, which will be fetched from the locale (based on priorities above). E.g. <html lang="en" data-i18n-dictionary-src="/libs/cq/i18n/dict.{+locale}.json">.



This class is a singleton and cannot be created directly.

Public Properties

Property Defined By
  I18n.LOCALE_DEFAULT : String
<static> The default locale (en).
I18n
  I18n.PSEUDO_LANGUAGE : String
<static> Language code for pseudo translations.
I18n
  I18n.PSEUDO_PATTERN_KEY : String
<static> Dictionary key for pseudo translation pattern.
I18n

Public Methods

Method Defined By

Public Events

This class has no public events.