Git Product home page Git Product logo

Comments (2)

ematipico avatar ematipico commented on June 1, 2024

I can see the bug, but your expectations isn't correct:

Loading localhost/fr should render the /pages/index.astro file with currentLocale set to fr (even when no /pages/fr/index.astro exists).

localhost/fr will redirect to localhost. There's no rendering here. The docs are explicit about it:

you can redirect a user from one locale to another on a per-language basis.

Also, your example isn't correct. Can you fix it? You created an en/ folder but didn't set prefixDefaultLocale: true.

from astro.

adamkoch avatar adamkoch commented on June 1, 2024

localhost/fr will redirect to localhost. There's no rendering here. The docs are explicit about it:

Fair enough but a redirect also doesn't seem to be working. The docs do say:

Astro will ensure that a page is built in src/pages/fr for every page that exists in src/pages/es/.

But I guess what you're saying is the page is built but all it has in it is a redirect to the fallback? I guess a feature request would be to be able to configure that behavior (perhaps possible with manual mode).

What I don't understand then, is if I have translated pages for all my site, but a single page not translated, and a user gets redirected to another locale as a fallback. Won't Astro then set currentLocale to the fallback locale, and therefore all future links from that page will also be the fallback locale? It seems like a better set up would be to render the fallback locale but with currentLocale still set to the original locale, but with some other property set which indicates it's a fallback page (so a banner or message can be displayed).

Also, your example isn't correct. Can you fix it? You created an en/ folder but didn't set prefixDefaultLocale: true.

Apologies, updated, I deleted the en/ folder as for my set up I had prefixDefaultLocale: false.

Thanks!

from astro.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.