photonui.Translation Class
A wrapper around Stone.js to fire locale events to widgets.
Documentation: https://github.com/flozz/stone.js/blob/master/README.md
NOTE: When you instantiate the translation widget, you can pass to it
the noGlobal
option to avoid the creation of the global window._
function.
wEvents:
- locale-changed:
- description: The locale changed.
- callback: function(widget, locale)
Constructor
photonui.Translation
-
params
Parameters:
-
params
ObjectAn object that can contain any property of the widget (optional).
Item Index
Methods
Properties
Methods
__onStonejsLocaleChanged
()
private
_bindEvent
-
id
-
element
-
evName
-
callback
-
[options]
Parameters:
_callCallbacks
-
wEvent
-
params
_updateProperties
-
properties
Parameters:
-
properties
ArrayThe properties to update.
addCatalogs
-
catalogs
Add one or more Stone.js catalog (a catalog contain all translated strings for a specific locale).
Parameters:
-
catalogs
Object
destroy
()
enableDomScan
-
boolean
Enable/disable Stone.js translating elements with the "stonejs" attribute in the DOM.
Parameters:
-
boolean
BooleanEnable or disable DOM scanning.
guessUserLanguage
()
String
Guess the user language.
Returns:
The language code (e.g. "en", "fr", "it",...)
lazyGettext
-
string
-
replacements
Make a string translatable.
The main difference between this method and the gettext
method is
that this method does not return a translated sting but an object that
will translate the sting when it will be displayed (.toString() method
called).
Parameters:
Returns:
registerCallback
-
id
-
wEvent
-
callback
-
thisArg
setBestMatchingLocale
-
locales
Find and set the best language for the user (depending on available catalogs and given language list).
updateDomTranslation
()
Re-translate elements with the "stonejs" attribute in the DOM.