1

I have function

const myTranslation = async () => {
  const translation = await i18n.loadNamespaces(['home']);
  console.log(translation); //-> return undefinded
  console.log(translation.t('title')); //-> return Uncaught (in promise) TypeError: Cannot read property 't' of undefined
};

How get my translation home.title ?

1 Answer 1

1

i18n.loadNamespaces just loads the required namespaces, in order to translate you need to use i18n.t.

const myTranslation = async () => {
  await i18n.loadNamespaces(['home']);
  console.log(i18n.t('title'));
  // --------------^
};

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.