Skip to content

Commit

Permalink
refactor: improve language change URL handling with regex for default…
Browse files Browse the repository at this point in the history
… language
  • Loading branch information
omdxp committed Dec 31, 2024
1 parent f1418e3 commit 091015b
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion web/src/redux/actions/settings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ export const changeLanguage = (languageCode: Language["code"]) => {

// remove code from url if it's the default language
if (language.code === Languages[0].code) {
newPath = newPath.replace(`/${language.code}`, "");
newPath = newPath.replace(new RegExp(`^/${language.code}`), "");
}

window.location.assign(newPath);
Expand Down

0 comments on commit 091015b

Please sign in to comment.