mirror of
https://github.com/gpxstudio/gpx.studio.git
synced 2025-08-31 15:43:25 +00:00
use homepage as default page
This commit is contained in:
@@ -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('/');
|
||||
}
|
Reference in New Issue
Block a user