Comments (2)
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.
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)
- Run [object Promise] ... to update HOT 6
- Body can't be set outside of layout HOT 1
- Partytown scripts break ViewTransition HOT 8
- Photoswipe works on localhost, but not hosted using @astrojs/vercel. HOT 2
- Build Error: Syntax error 'n' during static entrypoints building phase HOT 1
- MDX Layout css applied after component css on build HOT 4
- "TypeError: globalThis.astroAsset is undefined" and render broken when displaying images pulled from content collection inside hydrated Vue component HOT 5
- Inspect Popup exceeds window HOT 5
- Slot passthrough breaks default slot content HOT 3
- Bug with resolving imports when using viteServer.ssrLoadModule in astro adapter HOT 6
- Action unexpected end of json input
- Image component's sizes + widths attribute not coherent. HOT 3
- Lightningcss does not resolve url() inside an astro scoped style
- Experimental Rewrites - Including search params not matching index route for rewrites HOT 5
- Imported components in mdx content collection pages lose client scripts HOT 2
- Following installation steps for a template does not create the template HOT 1
- Remove duplicate class name HOT 2
- Astro gets stuck on installing dependencies (using terminal inside VS Code)
- Terminal hangs when installing dependencies in VS Code HOT 1
- IntrinsicAttributes and HTMLAttributes have conflicts HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from astro.