astrolicious / i18n

Yet another i18n integration for Astro with server and client utilities, type safety and translations built-in.
https://astro-i18n.netlify.app/
MIT License
48 stars 3 forks source link

Missing type definitions for original i18next properties #37

Open scrlkx opened 1 week ago

scrlkx commented 1 week ago

Hey!

Please, take a look into the config bellow.

import i18n from "@astrolicious/i18n";

i18n({
  ns: [
    "common",
    "home",
    "hero",
    "how-we-work",
    "our-clients",
    "services",
    "cases",
    "who-we-are",
    "careers",
    "blog",
    "contact",
    "footer",
    "404",
    "500",
  ],
  defaultNamespace: "common",
  locales: ["en", "es"],
  defaultLocale: "en",
  strategy: "prefix",
  rootRedirect: {
    status: 301,
    destination: "en",
  },
})

If you try to use it on astro.config.mjs you should have no problem, but if you try it to move it into a TypeScript file it will complain that the ns property doesn't exist.

Maybe we should inherit the original properties from i18next? Is there any workaround I can use to trick it to have all the original properties?

florian-lefebvre commented 1 week ago

Can you provide a minimal reproduction?

scrlkx commented 6 days ago

Sure, take a look at scrlkx/flaky-field. However, I just notice I don't really have to define any namespaces, your package (I believe) will automatically map them for me. If that's correct, maybe we should mention it somewhere in the docs?

florian-lefebvre commented 3 days ago

Indeed! It's not an bug but rather a docs issue. They could be clarified at https://astro-i18n.netlify.app/usage/translations/, wanna submit a PR?