Module: locale

Localizing script for SVG-edit UI

License:
  • MIT
Source:

Interfaces

LocaleEditorInit

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:
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:
Source:

LocaleStrings

The string keys of the object are two-letter language codes

Type:
Source:
Tutorials: