Skip to content

Commit

Permalink
typos in es endings
Browse files Browse the repository at this point in the history
  • Loading branch information
cnell-usgs committed Sep 17, 2024
1 parent fe4db09 commit b6e70c1
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/components/LanguageButton.vue
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,14 @@ function handleLanguageChange(event) {
function switchLanguage(lang) {
if (locale.value !== lang) {
locale.value = lang; // Update the locale
locale.value = lang;
// Update the URL with the new language
// Remove any existing language prefix from the current path
const currentPath = route.path.replace(/^\/(en|es)/, '');
// Construct the new path with the selected language
router.push({
path: `/${lang}${route.path.substring(3) || ''}` // Preserve the existing path, only change the language
path: `/${lang}${currentPath || '/'}`
});
}
}
Expand Down

0 comments on commit b6e70c1

Please sign in to comment.