Skip to content
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

getLocaleByPath() Returns i18nNoLocaleFoundInPath even though pathHasLocale() detects a locale #12808

Closed
1 task
shakram02 opened this issue Dec 22, 2024 · 0 comments
Labels
needs triage Issue needs to be triaged

Comments

@shakram02
Copy link

shakram02 commented Dec 22, 2024

Astro Info

Astro                    v5.1.1
Node                     v22.12.0
System                   Linux (x64)
Package Manager          npm
Output                   static
Adapter                  @astrojs/node
Integrations             none

If this issue only occurs in one browser, which browser is a problem?

No

Describe the Bug

I'm setting up two locales for my project. When I visit the /en path, getLocaleByPath throws an error, even though it's guarded inside pathHasLocale.

I want to use the result locale to determine the page direction in my HTML based on the locale I get as I don't know the path the user is currently browsing beforehand.

pathHasLocale returns true on the same path that getLocaleByPath fails at.

image

image

What's the expected result?

getLocaleByPath should return en

Link to Minimal Reproducible Example

https://stackblitz.com/edit/github-ttp7ddbz?file=src%2Fpages%2Findex.astro

Participation

  • I am willing to submit a pull request for this issue.
@github-actions github-actions bot added the needs triage Issue needs to be triaged label Dec 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs triage Issue needs to be triaged
Projects
None yet
Development

No branches or pull requests

1 participant