use base in URLs

This commit is contained in:
vcoppe
2024-07-08 19:13:31 +02:00
parent 09d25c2876
commit bff919c757
7 changed files with 23 additions and 20 deletions

View File

@@ -1,17 +1,3 @@
export const languages: Record<string, string> = {
'en': 'English',
};
export function getURLForLanguage(route: string | null, lang: string | null | undefined): string {
if (route === null) {
return '/';
}
let url = route.replace('[...language]', (lang === null || lang === undefined) ? 'en' : lang).replace('/en', '');
if (url === '') {
return '/';
} else {
return url;
}
}
};