Skip to content

Commit

Permalink
refactor: add missing jsdoc for I18n class methods (#3153)
Browse files Browse the repository at this point in the history
  • Loading branch information
qwerty541 authored Aug 27, 2023
1 parent eab5fc0 commit 20be439
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 20be439

Please sign in to comment.