Skip to content

Commit f934880

Browse files
committed
add currentLocale as new API
1 parent 6954fb2 commit f934880

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

proposals/0041-i18n-routing.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -247,6 +247,12 @@ This information is available through the global object `Astro`:
247247
> [!NOTE]
248248
> This feature is only available in **SSR**
249249
250+
### `Astro.currentLocale: string | undefined`
251+
252+
A new API that allows to retrieve the current locale, computed from the `URL` of the current request.
253+
254+
It's `undefined` if the URL doesn't contain a locale that is defined in `i18n.locales`. Although, if `routingStrategy` is set to `prefix-other-locales`, it's assumed that the `Astro.currentLocale` is the `i18n.defaultLocale`.
255+
250256
### Domain support
251257

252258
> [!NOTE]

0 commit comments

Comments
 (0)