Skip to content

Commit

Permalink
Fix trailing slash (#34)
Browse files Browse the repository at this point in the history
Co-authored-by: Florian Lefebvre <[email protected]>
  • Loading branch information
nojaf and florian-lefebvre authored Sep 5, 2024
1 parent 046d2e5 commit b81d4ed
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 5 deletions.
5 changes: 5 additions & 0 deletions .changeset/grumpy-sloths-shout.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@astrolicious/i18n": patch
---

Fixes an issue where locales would not be properly loaded depending on Astro `trailingSlash` value
2 changes: 1 addition & 1 deletion package/assets/middleware.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ const extractLocaleFromUrl = (pathname: string) => {
} else if (options.strategy === "prefixExceptDefault") {
if (
locale !== options.defaultLocale &&
pathname.startsWith(`/${locale}/`)
pathname.startsWith(`/${locale}`)
) {
return locale;
}
Expand Down
5 changes: 1 addition & 4 deletions package/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,7 @@
"./components/I18nClient.astro": "./assets/components/I18nClient.astro",
"./components/I18nHead.astro": "./assets/components/I18nHead.astro"
},
"files": [
"dist",
"assets"
],
"files": ["dist", "assets"],
"scripts": {
"dev": "tsup --watch",
"build": "tsup"
Expand Down

0 comments on commit b81d4ed

Please sign in to comment.