astro-i18next
astro-i18next copied to clipboard
📜 Plans for v1.0.0 release
astro-i18next
is currently in beta. Before releasing v1.0.0, some things need to be worked out, mainly to improve DX.
Developers should be able to translate their Astro website / app as fast as possible --> reduce manual tasks to setup / use the integration.
Roadmap:
- [x] add i18next plugins to config 👉 removed in beta.13, astro-i18next takes care of the basic stuff (loading translation strings, locale detection, etc.) 👉 added back in beta.14 (https://github.com/yassinedoghri/astro-i18next/commit/5ddb1c779367148fb0e690cd6503cba32d2bee59)
- [x]
npx astro-i18next generate
: generate localized pages using command (based on config file) (https://github.com/yassinedoghri/astro-i18next/issues/13) - [x] Translate routes, possible thanks to @Alexandre-Fernandez !
👉 Having
routes.json
files alongside pages would be best for i18n collaboration (#29) - [ ] #110
❌ MAYBE NO NEED: Probably by creating a Vite plugin and adding it to the
astro:config:setup
hook. 👉 use astro's injectRoute function in theastro:config:setup
to inject localized routes during build time. The generate CLI tool would most probably be discarded.pages
folder wouldn't need to include localized pages anymore! - [ ] Test support for SSR ✅ Works with node adapter ❌ Doesn't work with Netlify yet: https://github.com/yassinedoghri/astro-i18next/issues/26 - Reproduction 👉 Missing support for Deno
- [ ] Test client side i18n support ✅ Works with react 👉 try out with other frontend frameworks
- [ ] #108
- [ ]
npx astro-i18next init
: automaticastro-i18next
setup / config - [ ] Move the documentation from README.md to the website
- [ ] Release v1.0.0 🚀
EDIT 2022-11-06: beta.13 is now out and I'm getting closer to a clean and simple API for everyone. Any feedback is welcome!
if there anything you need from us just let me know @yassinedoghri 👊
Hot Module Reloading localized pages instead of running the npx astro-i18next generate command manually. Probably by creating a Vite plugin and adding it to the astro:config:setup hook.
This sounds super awesome!
Great! The Hot Module Reloading is a Must-have. Can't wait :)
would be nice to have SSR with deno too, right now can't build : Cannot bundle Node.js built-in "fs" imported from "node_modules/i18next-fs-backend/esm/fs.cjs". Consider disabling ssr.noExternal or remove the built-in dependency.
would be nice to have SSR with deno too, right now can't build : Cannot bundle Node.js built-in "fs" imported from "node_modules/i18next-fs-backend/esm/fs.cjs". Consider disabling ssr.noExternal or remove the built-in dependency.
Hey @bobcafedev, i18next-fs-backend is not a dependency. It's a plugin you can install to load your translation files. Seeing its documentation, it can be used with deno. So in your astro-i18next
config, I'm guessing you have to set the deno land url to use it:
/** @type {import('astro-i18next').AstroI18nextConfig} */
export default {
defaultLanguage: "en",
supportedLanguages: ["en", "fr"],
i18next: {
debug: true,
initImmediate: false,
backend: {
loadPath: "./src/locales/{{lng}}.json",
},
},
i18nextPlugins: { fsBackend: "https://deno.land/x/i18next_fs_backend/index.js" },
};
That being said, I've never used deno myself, and there maybe some more tweaking to be done in order to load i18next using its deno.land url. (https://deno.land/x/i18next/index.js)
add i18next plugins to config 👉 removed in beta.13, astro-i18next takes care of the basic stuff (loading translation strings, locale detection, etc.)
Is there any documentation for supporting plugins again? Using i18next-decode-postprocessor has been crucial for avoiding loading translated strings with special characters as html, e.g. via dangerouslySetInnerHTML
.
Is there any documentation for supporting plugins again? Using i18next-decode-postprocessor has been crucial for avoiding loading translated strings with special characters as html, e.g. via
dangerouslySetInnerHTML
.
Not in beta.13. I'll add support for plugins in the next release. Sorry for the trouble.
Edit: it's back on beta.14
@yassinedoghri is there any help you'd like around the extract
functionality? That's honestly the last bit I'd love to have before jumping in 100% and wouldn't mind helping out with it.
@yassinedoghri is there any help you'd like around the
extract
functionality? That's honestly the last bit I'd love to have before jumping in 100% and wouldn't mind helping out with it.
@lorenzolewis I wouldn't mind the help, thank you! 🙂
Just found an easy way to extract keys using i18next-scanner + merge them to resource files. Then, I'm guessing that there would only need to be a custom config for astro-i18next
.
Feel free to open a PR if you get it to work 👍
Edit: I've created an issue where we can discuss the implementation. #108
@yassinedoghri is there a separate issue for tracking "astro's injectRoute function in the astro:config:setup to inject localized routes" ?
@onionhammer just created it! #110
@yassinedoghri Any plans for supporting Cloudflare SSR adapter?
Edit: I'll be glad to help with it
@Luxauram you will need to incorporate the language into your links as well, the localizeUrl
utility is for that
@Luxauram you will need to incorporate the language into your links as well, the
localizeUrl
utility is for that
Dude sorry, you look intelligent... I have a problem with i18next and 404. I actually can't localizePath with the 404. So when I'm in the second lang pages and I type some wrong urls I get redirect to the 404 WITH THE DEFAULT Lang, not the actual I'm into.... How is this manageable? Can you help me?
Hey @yassinedoghri :wave: any updates?