mirror of
https://github.com/MichMich/MagicMirror.git
synced 2025-07-06 23:57:43 +00:00
Cleanup translator jsdoc
This commit is contained in:
parent
43bcf4ab98
commit
79f9331073
@ -31,12 +31,14 @@ var Translator = (function () {
|
|||||||
translations: {},
|
translations: {},
|
||||||
translationsFallback: {},
|
translationsFallback: {},
|
||||||
|
|
||||||
/* translate(module, key, variables)
|
/**
|
||||||
* Load a translation for a given key for a given module.
|
* Load a translation for a given key for a given module.
|
||||||
*
|
*
|
||||||
* argument module Module - The module to load the translation for.
|
* @param {object} module The module to load the translation for.
|
||||||
* argument key string - The key of the text to translate.
|
* @param {string} key The key of the text to translate.
|
||||||
* argument variables - The variables to use within the translation template (optional)
|
* @param {object} variables The variables to use within the translation template (optional)
|
||||||
|
*
|
||||||
|
* @returns {string} the translated key
|
||||||
*/
|
*/
|
||||||
translate: function (module, key, variables) {
|
translate: function (module, key, variables) {
|
||||||
variables = variables || {}; //Empty object by default
|
variables = variables || {}; //Empty object by default
|
||||||
@ -47,10 +49,10 @@ var Translator = (function () {
|
|||||||
* variables: {timeToWait: "2 hours", work: "painting"}
|
* variables: {timeToWait: "2 hours", work: "painting"}
|
||||||
* to: "Please wait for 2 hours before continuing with painting."
|
* to: "Please wait for 2 hours before continuing with painting."
|
||||||
*
|
*
|
||||||
* @param template
|
* @param {string} template Text with placeholder
|
||||||
* @param variables
|
* @param {object} variables Variables for the placeholder
|
||||||
*
|
*
|
||||||
* @returns {*}
|
* @returns {string} the template filled with the variables
|
||||||
*/
|
*/
|
||||||
function createStringFromTemplate(template, variables) {
|
function createStringFromTemplate(template, variables) {
|
||||||
if (Object.prototype.toString.call(template) !== "[object String]") {
|
if (Object.prototype.toString.call(template) !== "[object String]") {
|
||||||
@ -87,13 +89,13 @@ var Translator = (function () {
|
|||||||
return key;
|
return key;
|
||||||
},
|
},
|
||||||
|
|
||||||
/* load(module, file, isFallback, callback)
|
/**
|
||||||
* Load a translation file (json) and remember the data.
|
* Load a translation file (json) and remember the data.
|
||||||
*
|
*
|
||||||
* argument module Module - The module to load the translation file for.
|
* @param {object} module The module to load the translation file for.
|
||||||
* argument file string - Path of the file we want to load.
|
* @param {string} file Path of the file we want to load.
|
||||||
* argument isFallback boolean - Flag to indicate fallback translations.
|
* @param {boolean} isFallback Flag to indicate fallback translations.
|
||||||
* argument callback function - Function called when done.
|
* @param {Function} callback Function called when done.
|
||||||
*/
|
*/
|
||||||
load: function (module, file, isFallback, callback) {
|
load: function (module, file, isFallback, callback) {
|
||||||
if (!isFallback) {
|
if (!isFallback) {
|
||||||
@ -117,10 +119,10 @@ var Translator = (function () {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
/* loadCoreTranslations(lang)
|
/**
|
||||||
* Load the core translations.
|
* Load the core translations.
|
||||||
*
|
*
|
||||||
* argument lang String - The language identifier of the core language.
|
* @param {string} lang The language identifier of the core language.
|
||||||
*/
|
*/
|
||||||
loadCoreTranslations: function (lang) {
|
loadCoreTranslations: function (lang) {
|
||||||
var self = this;
|
var self = this;
|
||||||
@ -137,7 +139,7 @@ var Translator = (function () {
|
|||||||
self.loadCoreTranslationsFallback();
|
self.loadCoreTranslationsFallback();
|
||||||
},
|
},
|
||||||
|
|
||||||
/* loadCoreTranslationsFallback()
|
/**
|
||||||
* Load the core translations fallback.
|
* Load the core translations fallback.
|
||||||
* The first language defined in translations.js will be used.
|
* The first language defined in translations.js will be used.
|
||||||
*/
|
*/
|
||||||
|
Loading…
x
Reference in New Issue
Block a user