#What is the best way to translate slugs in the official i18n Astro?

18 messages · Page 1 of 1 (latest)

clever saffron
#

Currently, I feel like I'm repeating a lot of code by duplicating the same 'index.astro', but I can't find information...

Additionally, the folder structure ends up quite messy and disorganized...

Furthermore, I have also been forced to make each page a component, which again triples the folder structure

I haven't found a better solution, to be honest, it's really been bothering me.

/pages
  /es
    /sobre-nosotros
      index.astro
  index.astro
  /about-us
    index.stro
/components
  /pages
    MainPage.astro
    AboutUsPage.astro
cosmic tendon
cyan saffron
dreamy lance
paper nova
# clever saffron Currently, I feel like I'm repeating a lot of code by duplicating the same 'inde...
GitHub

A minimalist cv configurable via one JSON. Contribute to RodrigoTomeES/cv development by creating an account on GitHub.

Docs

Use dynamic routing and content collections to add internationalization support to your Astro site.

Docs

Learn how to use i18n routing in Astro.

cyan saffron
cyan saffron
cyan saffron
# paper nova you can check my repo https://github.com/RodrigoTomeES/cv I recently implemented...

Very interesting, thanks for sharing! I didn't put the content for my default language in its separate folder and can see now, that it might be good idea to do that. One thing which still confuses the hell out of me is, why do we need src/i18n/config.ts, if we now can configure i18n in astro.config.mjs (https://docs.astro.build/en/guides/internationalization/#configure-i18n-routing)? And as a follow up question (which, I guess, shows my lack of basic JS knowledge 😬 ), if we configure it in astro.config.mjs, how can we access the properties defaultLocale and locales when needed?

zenith ice
#

I define the locales in i18n.ts and import those to astro.config.js. I don't know why it's not set up like that in the docs, as the whole point of a good i18n setup is that you don't have maintain settings in multiple places.

#

Anyway, IMO the marketing material around the i18n features aren't factually incorrect, but give the impression of being more than what it is. It's far from what a complete, flexible implementation may need. My hope is that the team had more in mind and will ship more later on. I tried to set up the starter in such a way that the additions are hopefully easy to replace with new, native functions.

#

i18n Next may be better in many respects, but I'm afraid that building the foundations on that right now will make it difficult to replace it with future built-in Astro features. Not sure if that fear is justified—I just don't know it well enough.

cyan saffron
paper nova
cyan saffron
paper nova
#

Anyway I think the documentation and Astro implementation is better than Next.js default i18n

cyan saffron