Module puredom.i18n
-
Internationalization extension for puredom.
- Defined in: i18n.js
| Constructor Attributes | Constructor Name and Description |
|---|---|
|
When called as a function, acts as an alias of puredom.i18n.localize.
|
| Field Attributes | Field Name and Description |
|---|---|
| <inner> |
Method Summary
| Method Attributes | Method Name and Description |
|---|---|
| <static> |
puredom.i18n.
addLang
(langCode, definition)
Add a locale definition.
|
| <static> |
puredom.i18n.
getLang
(langCode)
Get the locale definition corresponding to the given language code.
|
| <static> |
puredom.i18n.
hasLang
(langCode)
Check if a locale definition is registered for the given language code.
|
| <static> |
puredom.i18n.
localize
(value, langCode, defaultValue, options)
Localize a variable.
|
| <static> |
puredom.i18n.
localizeDOM
(selection)
Apply the global locale definition to a selection (puredom.NodeSelection).
|
| <static> |
puredom.i18n.
setLang
(langCode)
Set the global locale.
|
Field Detail
<inner>
langs
Method Detail
-
<static> {this} puredom.i18n.addLang(langCode, definition)Add a locale definition.
- Parameters:
- {String} langCode
- A language code
- {Object} definition
- A key-value JSON object that defines labels and formats
- Returns:
- {this}
-
<static> {Object} puredom.i18n.getLang(langCode)Get the locale definition corresponding to the given language code.
- Parameters:
- {String} langCode
- A language code to retrieve the definition for.
- Returns:
- {Object} locale, or
falseon error.
-
<static> {Boolean} puredom.i18n.hasLang(langCode)Check if a locale definition is registered for the given language code.
- Parameters:
- {String} langCode
- A language code to check for.
- Returns:
- {Boolean} exists
-
<static> puredom.i18n.localize(value, langCode, defaultValue, options)Localize a variable.
- Parameters:
- {Any} value
- A value to localize. Ex: a Date, Number or String
- {String} langCode Optional, Default: i18n.locale
- An alternative language code to use.
- {String} defaultValue Optional
- A fallback value to use if no localized value can be generated.
- {Object} options Optional
- Configuration object.
-
<static> puredom.i18n.localizeDOM(selection)Apply the global locale definition to a selection (puredom.NodeSelection).
Looks fordata-i18n-idattributes, and updates their owner nodes' contents with the corresponding String from the global locale definition.- Parameters:
- {puredom.NodeSelection} selection
- A selection to apply the global locale definition to.
-
<static> {this} puredom.i18n.setLang(langCode)Set the global locale.
- Parameters:
- {String} langCode
- The new language code to apply globally.
- Returns:
- {this}