i18next / next-i18next

The easiest way to translate your NextJs apps.
https://next.i18next.com
MIT License
5.57k stars 761 forks source link

I18n works perfectly, but interpolation doesn't #1783

Closed meness closed 2 years ago

meness commented 2 years ago

It probably is not a bug, but I need your help.

Describe the bug

// inside a functional component
const [t] = useTranslation();

// key = Hey {name}
t('key', { name: 'Sam' }) // prints: Hey {name}

// for the same component
export const getStaticProps: GetStaticProps = async ({ locale }) => {
  const i18next = await serverSideTranslations(locale as string);

  return {
    props: {
      ...i18next,
    },
  };
};
// config
const options = {
  i18n: {
    defaultLocale: 'en-US',
    locales: [
      'en-US',
    ],
  },
  reloadOnPrerender: true,
  cleanCode: true,
  keySeparator: false,
};

module.exports = options;

Occurs in next-i18next version

11.0.0

Steps to reproduce

Expected behaviour

Screenshots

OS (please complete the following information)

Additional context

isaachinman commented 2 years ago

Please post on StackOverflow for help.