Skip to content

Commit b81d4ed

Browse files
Fix trailing slash (#34)
Co-authored-by: Florian Lefebvre <contact@florian-lefebvre.dev>
1 parent 046d2e5 commit b81d4ed

File tree

3 files changed

+7
-5
lines changed

3 files changed

+7
-5
lines changed

.changeset/grumpy-sloths-shout.md

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@astrolicious/i18n": patch
3+
---
4+
5+
Fixes an issue where locales would not be properly loaded depending on Astro `trailingSlash` value

package/assets/middleware.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ const extractLocaleFromUrl = (pathname: string) => {
1111
} else if (options.strategy === "prefixExceptDefault") {
1212
if (
1313
locale !== options.defaultLocale &&
14-
pathname.startsWith(`/${locale}/`)
14+
pathname.startsWith(`/${locale}`)
1515
) {
1616
return locale;
1717
}

package/package.json

+1-4
Original file line numberDiff line numberDiff line change
@@ -38,10 +38,7 @@
3838
"./components/I18nClient.astro": "./assets/components/I18nClient.astro",
3939
"./components/I18nHead.astro": "./assets/components/I18nHead.astro"
4040
},
41-
"files": [
42-
"dist",
43-
"assets"
44-
],
41+
"files": ["dist", "assets"],
4542
"scripts": {
4643
"dev": "tsup --watch",
4744
"build": "tsup"

0 commit comments

Comments
 (0)