use homepage as default page

This commit is contained in:
vcoppe
2024-07-08 15:46:00 +02:00
parent b38ff26a64
commit 5ed0e75427
10 changed files with 273 additions and 283 deletions

View File

@@ -1,3 +1,18 @@
export const languages: Record<string, string> = {
'en': 'English',
};
};
export function getURLForLanguage(lang?: string): string {
let currentPath = window.location.pathname;
let currentPathArray = currentPath.split('/');
if (currentPathArray.length > 1 && languages.hasOwnProperty(currentPathArray[1])) {
currentPathArray.splice(1, 1);
}
if (lang !== undefined && lang !== 'en') {
currentPathArray.splice(1, 0, lang);
}
return currentPathArray.join('/');
}