Skip to content

Commit

Permalink
refactor: add missing jsdoc for I18n class methods (anuraghazra#3153)
Browse files Browse the repository at this point in the history
  • Loading branch information
qwerty541 committed Dec 22, 2023
1 parent d0cca99 commit ea95655
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions src/common/I18n.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down

0 comments on commit ea95655

Please sign in to comment.