-
-
Notifications
You must be signed in to change notification settings - Fork 2.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(i18n): add
Astro.currentLocale
(#9101)
- Loading branch information
Showing
17 changed files
with
222 additions
and
16 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 | ||
--- | ||
|
||
Add a new property `Astro.currentLocale`, available when `i18n` is enabled. |
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
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
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
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
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
5 changes: 5 additions & 0 deletions
5
packages/astro/test/fixtures/i18n-routing-prefix-always/src/pages/en/start.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 |
---|---|---|
@@ -1,8 +1,13 @@ | ||
--- | ||
const currentLocale = Astro.currentLocale; | ||
--- | ||
<html> | ||
<head> | ||
<title>Astro</title> | ||
</head> | ||
<body> | ||
Start | ||
Current Locale: {currentLocale ? currentLocale : "none"} | ||
|
||
</body> | ||
</html> |
4 changes: 4 additions & 0 deletions
4
packages/astro/test/fixtures/i18n-routing-prefix-always/src/pages/pt/start.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 |
---|---|---|
@@ -1,8 +1,12 @@ | ||
--- | ||
const currentLocale = Astro.currentLocale; | ||
--- | ||
<html> | ||
<head> | ||
<title>Astro</title> | ||
</head> | ||
<body> | ||
Oi essa e start | ||
Current Locale: {currentLocale ? currentLocale : "none"} | ||
</body> | ||
</html> |
12 changes: 12 additions & 0 deletions
12
packages/astro/test/fixtures/i18n-routing/src/pages/current-locale.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,12 @@ | ||
--- | ||
const currentLocale = Astro.currentLocale; | ||
--- | ||
|
||
<html> | ||
<head> | ||
<title>Astro</title> | ||
</head> | ||
<body> | ||
Current Locale: {currentLocale ? currentLocale : "none"} | ||
</body> | ||
</html> |
19 changes: 19 additions & 0 deletions
19
packages/astro/test/fixtures/i18n-routing/src/pages/dynamic/[id].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,19 @@ | ||
|
||
--- | ||
export function getStaticPaths() { | ||
return [ | ||
{ id: "lorem" } | ||
] | ||
} | ||
const currentLocale = Astro.currentLocale; | ||
|
||
--- | ||
|
||
<html> | ||
<head> | ||
<title>Astro</title> | ||
</head> | ||
<body> | ||
Current Locale: {currentLocale ? currentLocale : "none"} | ||
</body> | ||
</html> |
4 changes: 4 additions & 0 deletions
4
packages/astro/test/fixtures/i18n-routing/src/pages/pt/start.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 |
---|---|---|
@@ -1,8 +1,12 @@ | ||
--- | ||
const currentLocale = Astro.currentLocale; | ||
--- | ||
<html> | ||
<head> | ||
<title>Astro</title> | ||
</head> | ||
<body> | ||
Hola | ||
Current Locale: {currentLocale ? currentLocale : "none"} | ||
</body> | ||
</html> |
Oops, something went wrong.