new mmir.compat.v1.LanguageManager(compatibilitySelf)
Set to "backwards compatibility mode v1" (for pre version 2.0) for LanguageManager.
NOTE: needs
mmir.compat.v1.CoreCompat
to be set first!
This function re-adds deprecated and removed functions and
properties to the CommonUtils instance.
NOTE that once set to compatibility mode, it cannot be reset to
non-compatibility mode.
In addition, the following functions of LanguageManager are made accessible
on the mmir.LanguageManager
instance with these additional names
-
mmir.LanguageManager#getLanguage
as getCurrentLanguage() : String -
mmir.LanguageManager#existsGrammar
as existsGrammarForLanguage(String: lang) : Boolean -
mmir.LanguageManager#existsDictionary
as existsDictionaryForLanguage(String: lang) : Boolean -
mmir.LanguageManager#existsSpeechConfig
as existsSpeakerForLanguage(String: lang) : Boolean -
mmir.LanguageManager#setNextLanguage
as cycleLanguages()
Name | Type | Description |
---|---|---|
compatibilitySelf |
mmir.LanguageManager | the instance of mmir.LanguageManager to which the compatibility functions etc. will be attached |
Example
mmir.require(['mmirf/core3Compatibility', 'mmirf/languageManagerCompatibility', 'mmirf/core', 'mmirf/languageManager'], function(setCoreCompatibility, setLanguageManagerCompatibility, mmir, languageManager){
setCoreCompatibility(mmir);
setLanguageManagerCompatibility(languageManager);
});
Methods
-
changeLanguage(newLang, doReRenderView){String}
-
FIXME does not work, since PresentationManager.reRenderView was removed! This function changes the application language and, if requested, renders the current view again, so that the change of the language is applied to the currently displayed view. After changing the language (and re-rendering the view) an event "language_choosen" is raised on the DialogManager.
Note: Momentarily this function is used by 'controllers/application.js' to generate a menu to choose the application language.
This should better be implemented as a partial.Name Type Description newLang
String The new language which is to be used henceforth doReRenderView
Boolean Should the currently displayed view be rendered again in the new language? Returns:
Type Description String The translation of the keyword -
translateHTML(html){String}
-
This function is used to localize the view description (ehtml) before they are displayed.
Name Type Description html
String The (HTML) string which is to be localized into the currently used language - Deprecated
- used for old template format
Throws:
-
if
mmir.CommonUtils#getTranslationRegExp
is not available (i.e. commonUtils has not been set to compatibility mode) - Type
- Error
Returns:
Type Description String The localized (HTML) string