-
-
Notifications
You must be signed in to change notification settings - Fork 2.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(i18n): disable redirect to default language #9638
Conversation
🦋 Changeset detectedLatest commit: 598a1ae The changes in this PR will be included in the next version bump. Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
case 'pathname-prefix-always': { | ||
if (url.pathname === base + '/' || url.pathname === base) { | ||
if (trailingSlash === 'always') { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unrelated: It looks like the prefix is only added when trailingSlash
is set to always
. Shouldn't the prefix also be added for other trailingSlash
configurations?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Right, although to check the other variants, we need build.format
, which is a piece of information that we don't have in SSR (in the SSR manifest), that's why I only check always
. Should we store build.format
in the SSRManifest
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah ok that makes sense. I think it's fine to store build.format
then if it helps improve things here. We can definitely improve this in a later PR.
Co-authored-by: Bjorn Lu <[email protected]>
bd56a60
to
5a864a1
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, @ematipico ! Made some suggestions here, based on the docs PR suggestions I made. See what you think of these, and edit to taste!
Co-authored-by: Sarah Rainsberger <[email protected]>
Co-authored-by: Sarah Rainsberger <[email protected]>
…9666) * Remove the header script before a view transition takes place to force a reload on the next page * Add changeset * Save another char
… to toolbar/apps (#9647) * refactor(toolbar): Rename every internal reference of overlay/plugins to toolbar/apps * refactor: rename vite plugin * fix: update import * nit: add setting fallback
* fix(i18n): emit an error when the index isn't found * changeset * Update .changeset/proud-guests-bake.md Co-authored-by: Sarah Rainsberger <[email protected]> * rename * Update packages/astro/src/core/errors/errors-data.ts Co-authored-by: Florian Lefebvre <[email protected]> --------- Co-authored-by: Sarah Rainsberger <[email protected]> Co-authored-by: Florian Lefebvre <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Docs is happy! Looking forward to this, @ematipico ! 🥳
07defb4
to
a5fd580
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This PR is blocked because it contains a minor
changeset. A reviewer will merge this at the next release if approved.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great 👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This PR is blocked because it contains a minor
changeset. A reviewer will merge this at the next release if approved.
Changes
Closes PLT-1318
This PR adds a new option to the
i18n.routing
object, calledredirectToDefaultLocale
, which comes into play when the optionprefixDefaultLocale
comes into play (it'strue
).This new option is
true
by default to maintain the current behaviour of the routing, where Astro does a redirect from/
to/<defaultLocale>
.When this option is set to
false
, the redirect isn't triggered anymore.List of technical changes inside the PR:
redirectToDefaultLocale
isfalse
andprefixDefaultLocale
isfalse
. The reason why I added an error is that this combination of options doesn't have any effect, so I want to enforce a sense of correctness when configuring the i18n.Testing
I added new test cases that should cover DEV, SSG and SSR
Docs
/cc @withastro/maintainers-docs for feedback!
I will create a PR in the docs repository to update the page.