website hosted

This commit is contained in:
root
2025-10-17 21:06:57 +00:00
parent 14b2d53e8e
commit 73cdd255a9
308 changed files with 88840 additions and 9 deletions

View File

@@ -0,0 +1,24 @@
function parseI18nUrl(url, defaultLocale, locales, base) {
if (!url.startsWith(base)) {
return void 0;
}
let s = url.slice(base.length);
if (!s || s === "/") {
return { locale: defaultLocale, path: "/" };
}
if (s[0] !== "/") {
s = "/" + s;
}
const locale = s.split("/")[1];
if (locale in locales) {
let path = s.slice(1 + locale.length);
if (!path) {
path = "/";
}
return { locale, path };
}
return { locale: defaultLocale, path: s };
}
export {
parseI18nUrl
};