Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Text is undefined and 'Missing helper: "__" ' #49

Open
swap1789 opened this issue Nov 15, 2022 · 1 comment
Open

Text is undefined and 'Missing helper: "__" ' #49

swap1789 opened this issue Nov 15, 2022 · 1 comment

Comments

@swap1789
Copy link

I am getting 'undefined' for the text when checked inside storybook. And it throws 'Missing helper: "__" ' error when I try to run the local dev server ?
I used npm i handlebars-i18n to install the required dependencies and in my js file I have imported them as follows. Please let me know if I am missing something

import 'handlebars';
import i18next from 'i18next';
import HandlebarsI18n from 'handlebars-i18n';

HandlebarsI18n.init();
const initialize = () => {
i18next.init({
resources: {
en: {
translation: {
phrase1: 'What is good?',
phrase2: '{{thing}} is good.',
},
},
de: {
translation: {
phrase1: 'Was ist gut?',
phrase2: '{{thing}} ist gut.',
},
},
},
lng: 'en',
});
};

document.addEventListener('DOMContentLoaded', initialize);

@chrwlk
Copy link

chrwlk commented Aug 25, 2023

I also had the problem of getting undefined for all translations within tests with Vitest. I was able to solve it by passing i18next.

  i18next.init({
    resources: {
      en: {
        translation: {
          phrase1: 'What is good?',
          phrase2: '{{thing}} is good.',
        },
      },
    },
    lng: "en",
  });

  handlebarsI18n.init(undefined, i18next);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants