diff --git a/src/common/I18n.js b/src/common/I18n.js index 8d80a8510bc5c..a2eccc08ac054 100644 --- a/src/common/I18n.js +++ b/src/common/I18n.js @@ -2,12 +2,25 @@ * I18n translation class. */ class I18n { + /** + * Constructor. + * + * @param {Object} options Options. + * @param {string} options.locale Locale. + * @param {Object} options.translations Translations. + */ constructor({ locale, translations }) { this.locale = locale; this.translations = translations; this.fallbackLocale = "en"; } + /** + * Get translation. + * + * @param {string} str String to translate. + * @returns {string} Translated string. + */ t(str) { const locale = this.locale || this.fallbackLocale;