Localizing script for SVG-edit UI
- Copyright:
- 2010 Alexis Deveria
- License:
- MIT
- Source:
Interfaces
Members
(static, constant) setStrings
Looks for elements to localize using the supplied obj to indicate
on which selectors (or IDs if ids is set to true) to set its
strings (with selectors relative to the editor root element). All
keys will be translated, but for each selector, only the first item
found matching will be modified.
If the type is content, the selector-identified element's children
will be checked, and the first (non-empty) text (placeholder) node
found will have its text replaced.
If the type is title, the element's title
property will be set.
If the type is aria-label, the element's aria-label attribute
will be set (i.e., instructions for screen readers when there is
otherwise no visible text to be read for the function of the form
control).
- Source:
Methods
(static) init(editor) → {void}
Sets the current editor instance (on which addLangData) exists.
Parameters:
| Name | Type | Description |
|---|---|---|
editor |
module:locale.LocaleEditorInit |
- Source:
Returns:
- Type
- void
(static) putLocale(givenParam, goodLangs, conf) → {Promise.<module:locale.LangAndData>}
Parameters:
| Name | Type | Description |
|---|---|---|
givenParam |
string | |
goodLangs |
Array.<string> | |
conf |
Object |
- Source:
Fires:
- module:svgcanvas.SvgCanvas#event:ext_addLangData
- module:svgcanvas.SvgCanvas#event:ext_langReady
- module:svgcanvas.SvgCanvas#event:ext_langChanged
Returns:
Resolves to result of module:locale.readLang
- Type
- Promise.<module:locale.LangAndData>
(static) readLang(langData) → {Promise.<module:locale.LangAndData>}
Parameters:
| Name | Type | Description |
|---|---|---|
langData |
module:locale.LocaleStrings | See Locale Docs |
- Source:
Fires:
Returns:
Resolves to LangAndData
- Type
- Promise.<module:locale.LangAndData>
Type Definitions
AddLangExtensionLocaleData
The "data" property is generally set to an an array of objects with "id" and "title" or "textContent" properties
Type:
Properties:
| Name | Type | Description |
|---|---|---|
data |
Array.<module:locale.LocaleStrings> | See Locale Docs |
- Source:
LangAndData
Type:
Properties:
| Name | Type | Description |
|---|---|---|
langParam |
string | |
langData |
module:locale.LocaleStrings |
- Source:
LocaleArray
Used, for example, in the ImageLibs extension, to present libraries (with name/URL/description) in order
Type:
- Source:
LocaleSelectorValue
Type:
- PlainObject.<string, string>
- Source:
LocaleStrings
The string keys of the object are two-letter language codes
Type:
- PlainObject.<string, (string|module:locale.LocaleStrings|module:locale.LocaleArray)>
- Source:
- Tutorials: