slickgrid-react
Version:
Slickgrid components made available in React
35 lines • 1.1 kB
JavaScript
/**
* This is a Translate Service Wrapper for Slickgrid-Universal monorepo lib to work properly,
* it must implement Slickgrid-Universal TranslaterService interface to work properly
*/
export class TranslaterI18NextService {
i18n;
/** I18Next instance setter */
set i18nInstance(i18n) {
this.i18n = i18n;
}
/**
* Method to return the current language used by the App
* @return {string} current language
*/
getCurrentLanguage() {
return this.i18n?.language || '';
}
/**
* Method to set the language to use in the App and Translate Service
* @param {string} language
* @return {Promise} output
*/
async use(newLang) {
return this.i18n?.changeLanguage(newLang);
}
/**
* Method which receives a translation key and returns the translated value assigned to that key
* @param {string} translation key
* @return {string} translated value
*/
translate(translationKey) {
return this.i18n?.t(translationKey) || '';
}
}
//# sourceMappingURL=translaterI18Next.service.js.map