Cleanup translator jsdoc

This commit is contained in:
rejas 2020-07-27 14:26:01 +02:00
parent 43bcf4ab98
commit 79f9331073

View File

@ -31,12 +31,14 @@ var Translator = (function () {
translations: {},
translationsFallback: {},
/* translate(module, key, variables)
/**
* Load a translation for a given key for a given module.
*
* argument module Module - The module to load the translation for.
* argument key string - The key of the text to translate.
* argument variables - The variables to use within the translation template (optional)
* @param {object} module The module to load the translation for.
* @param {string} key The key of the text to translate.
* @param {object} variables The variables to use within the translation template (optional)
*
* @returns {string} the translated key
*/
translate: function (module, key, variables) {
variables = variables || {}; //Empty object by default
@ -47,10 +49,10 @@ var Translator = (function () {
* variables: {timeToWait: "2 hours", work: "painting"}
* to: "Please wait for 2 hours before continuing with painting."
*
* @param template
* @param variables
* @param {string} template Text with placeholder
* @param {object} variables Variables for the placeholder
*
* @returns {*}
* @returns {string} the template filled with the variables
*/
function createStringFromTemplate(template, variables) {
if (Object.prototype.toString.call(template) !== "[object String]") {
@ -87,13 +89,13 @@ var Translator = (function () {
return key;
},
/* load(module, file, isFallback, callback)
/**
* Load a translation file (json) and remember the data.
*
* argument module Module - The module to load the translation file for.
* argument file string - Path of the file we want to load.
* argument isFallback boolean - Flag to indicate fallback translations.
* argument callback function - Function called when done.
* @param {object} module The module to load the translation file for.
* @param {string} file Path of the file we want to load.
* @param {boolean} isFallback Flag to indicate fallback translations.
* @param {Function} callback Function called when done.
*/
load: function (module, file, isFallback, callback) {
if (!isFallback) {
@ -117,10 +119,10 @@ var Translator = (function () {
}
},
/* loadCoreTranslations(lang)
/**
* 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) {
var self = this;
@ -137,7 +139,7 @@ var Translator = (function () {
self.loadCoreTranslationsFallback();
},
/* loadCoreTranslationsFallback()
/**
* Load the core translations fallback.
* The first language defined in translations.js will be used.
*/