#i18n not working properly

3 messages · Page 1 of 1 (latest)

crisp peak
#

hi

I'm wrapping me head around this for a solid couple of hours now. I'm following astro-i18next README:

https://github.com/yassinedoghri/astro-i18next#generate

but cannot generate the translated pages. All I get is the site.title string:

<p>{t("site.title")}</p>

renders:

site.title

I have:

  • astroI18next() added to the integrations array in astro.config.mjs
  • astro-i18next.config.mjs looks like this:
/** @type {import('astro-i18next').AstroI18nextConfig} */
export default {
  defaultLocale: "en",
  locales: ["en", "pt"],
};
  • locales folder inside public with en and pt folders with translation.json with the contents from the README

I ran:

  • npx astro-i18next generate
    and even npm run build and served the content directly from dist

and it doesn't recognize anything. It renders the plain string above. What am I doing wrong?

GitHub

An astro integration of i18next + some utility components to help you translate your astro websites! - GitHub - yassinedoghri/astro-i18next: An astro integration of i18next + some utility componen...

little cosmos
#

Enable debug and collect the errors.

crisp peak
#

sorted this out! silly me added the comment line on the JSON translation file since I copy pasted from the README