-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(i18n): fix regression in current locale (#9998)
* fix(i18n): fix regression in current locale * Update .changeset/shy-wolves-ring.md * Update packages/astro/test/i18n-routing.test.js Co-authored-by: Bjorn Lu <[email protected]> * Update .changeset/six-fishes-beg.md Co-authored-by: Bjorn Lu <[email protected]> * fix test case --------- Co-authored-by: Bjorn Lu <[email protected]>
- Loading branch information
Showing
6 changed files
with
127 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
"astro": patch | ||
--- | ||
|
||
Fixes a bug in `Astro.currentLocale` that wasn't returning the correct locale when a locale is configured via `path` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
"astro": patch | ||
--- | ||
|
||
Fixes a regression in `Astro.currentLocale` where it stopped working properly with dynamic routes |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
22 changes: 22 additions & 0 deletions
22
packages/astro/test/fixtures/i18n-routing/src/pages/blog/[...lang]/index.astro
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
--- | ||
const currentLocale = Astro.currentLocale; | ||
export async function getStaticPaths() { | ||
return [ | ||
{ params: { lang: undefined } }, | ||
{ params: { lang: 'es' } } | ||
] | ||
} | ||
--- | ||
|
||
|
||
<html> | ||
<head> | ||
<title>Astro</title> | ||
</head> | ||
<body> | ||
Current Locale: {currentLocale ? currentLocale : "none"} | ||
</body> | ||
</html> |
13 changes: 13 additions & 0 deletions
13
packages/astro/test/fixtures/i18n-routing/src/pages/spanish/index.astro
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
--- | ||
const currentLocale = Astro.currentLocale; | ||
--- | ||
|
||
<html> | ||
<head> | ||
<title>Astro</title> | ||
</head> | ||
<body> | ||
Current Locale: {currentLocale ? currentLocale : "none"} | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters