INNER CODE UNIT · TypeScript

TranslateService

kanzitelli/rnn-starter · src/services/translate/index.ts:7

export class TranslateService implements IService {
  private inited = false;
  private i18n = new I18n(translations);

  init = async (): PVoid => {
    if (!this.inited) {
      this.setup();

      this.inited = true;
    }
  };

  do = (scope: Scope, options?: TranslateOptions | undefined) =>
    this.i18n.t(scope, options);

  setup = (): void => {
    const {ui} = stores;
    const lng = Localization.locale;

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…