-
-
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): correctly compute the current locale (#12199)
* fix(i18n): correctly compute the current locale * Update packages/astro/test/fixtures/i18n-routing-dynamic/src/pages/[language].astro Co-authored-by: Bjorn Lu <[email protected]> * make code more readable * rebase --------- Co-authored-by: Bjorn Lu <[email protected]>
- Loading branch information
Showing
9 changed files
with
82 additions
and
10 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 regression in the computation of `Astro.currentLocale` |
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
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
13 changes: 13 additions & 0 deletions
13
packages/astro/test/fixtures/i18n-routing-dynamic/astro.config.mjs
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 @@ | ||
import { defineConfig } from "astro/config"; | ||
|
||
// https://astro.build/config | ||
export default defineConfig({ | ||
i18n: { | ||
defaultLocale: "ru", | ||
locales: ["ru", "en"], | ||
routing: { | ||
prefixDefaultLocale: true, | ||
}, | ||
}, | ||
}); | ||
|
8 changes: 8 additions & 0 deletions
8
packages/astro/test/fixtures/i18n-routing-dynamic/package.json
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,8 @@ | ||
{ | ||
"name": "@test/i18n-routing-dynamic", | ||
"version": "0.0.0", | ||
"private": true, | ||
"dependencies": { | ||
"astro": "workspace:*" | ||
} | ||
} |
11 changes: 11 additions & 0 deletions
11
packages/astro/test/fixtures/i18n-routing-dynamic/src/pages/[language].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,11 @@ | ||
--- | ||
export async function getStaticPaths() { | ||
return [{ params: { language: "ru" } }, { params: { language: "en" } }]; | ||
} | ||
const { currentLocale } = Astro; | ||
--- | ||
|
||
<div> | ||
{currentLocale} | ||
</div> |
Empty file.
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.