refactor: add missing jsdoc for I18n class methods (#3153)

This commit is contained in:
Alexandr Garbuzov
2023-08-27 10:54:07 +03:00
committed by GitHub
parent eab5fc0274
commit 20be43939b
+13
View File
@@ -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;