fix some URLs

This commit is contained in:
vcoppe
2024-08-16 12:51:55 +02:00
parent fa30739fd0
commit 49582dcddd
3 changed files with 13 additions and 7 deletions

View File

@@ -122,8 +122,8 @@ export function setScissorsCursor() {
setCursor(scissorsCursor);
}
export function getURLForLanguage(lang: string | null | undefined, path?: string): string {
let newPath = path ?? (browser ? window.location.pathname.replace(base, '') : '');
export function getURLForLanguage(lang: string | null | undefined, path: string): string {
let newPath = path.replace(base, '');
let languageInPath = newPath.split('/')[1];
if (!languages.hasOwnProperty(languageInPath)) {
languageInPath = 'en';