From b6e70c10410b8c32d6762c778023e8147f595747 Mon Sep 17 00:00:00 2001
From: Cee <cnell@usgs.gov>
Date: Mon, 16 Sep 2024 17:46:33 -0700
Subject: [PATCH] typos in es endings

---
 src/components/LanguageButton.vue | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/src/components/LanguageButton.vue b/src/components/LanguageButton.vue
index b2609ee..50b493a 100644
--- a/src/components/LanguageButton.vue
+++ b/src/components/LanguageButton.vue
@@ -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 || '/'}`
     });
   }
 }
-- 
GitLab