Alexandre-Fernandez / astro-i18n

A TypeScript-first internationalization library for Astro.
https://www.npmjs.com/package/astro-i18n
MIT License
249 stars 10 forks source link

Using astro-i18n with new content folder #25

Closed agonist closed 1 year ago

agonist commented 1 year ago

Hi, first great job, I'm enjoying using the library and would be potentially keen to contribute.

I have successfully published a website using it, but now that I want to add a blog section, I wonder how to combine this lib with the new Astro content folder.

if simply using it naively with a [slug].astro page and my md files in the content folder we will endup having duplicated route in each language.

What I'm expecting to have:

But what is being generated let you access:

Which is normal considering how both systems works. So I'm wondering, at which level could we make sure this does not happen ? I'm not an Astro expert yet but if something could make it happen I'd be happy to try and implement it.

Maybe by giving the possibility to ignore some page in the i18n.config it could helps 🤔

Alexandre-Fernandez commented 1 year ago

hi, can you make a repo showcasing the problem you're describing ? EDIT: I'm going to close this until a repository is made.

narduin commented 1 year ago

Hey @agonist, I made my website using Astro content folder and this very plugin for translating everything (french and english). You can check out how I did it here. The logic behind single post translation is here.

I'm not saying this is the proper way but it works so far :)

agonist commented 1 year ago

@narduin sounds great ! I will take a look thanks. didn't had time to work on it again but if I'm still running into the issue I'll post a repo.