Skip to content
Snippets Groups Projects
Unverified Commit d42a0a62 authored by Éloïs's avatar Éloïs
Browse files

feat: translate app title

parent 95b23d1d
No related branches found
No related tags found
No related merge requests found
Pipeline #40003 passed
<script setup lang="ts">
import { computed, onMounted, ref } from 'vue'
import { computed, onMounted, ref, watch } from 'vue'
import { bma } from '@/composables/bma'
import { extractForumData } from '@/composables/forumData'
import { useI18n } from '@/composables/i18n'
......@@ -130,8 +130,19 @@ async function initializeFromForum() {
}
}
// Initialization on page load
// Update document title when language changes
function updateDocumentTitle() {
document.title = t.value.appTitle || 'Ğ1 vote view'
}
// Watch for language changes to update the title
watch(currentLanguage, () => {
updateDocumentTitle()
})
// Update title on mount
onMounted(async () => {
updateDocumentTitle()
// Parallel loading of forum data and last block
await Promise.all([initializeFromForum(), fetchLastBlock()])
......@@ -164,6 +175,7 @@ function setLanguage(lang: string) {
currentLanguage.value = lang
localStorage.setItem('userLanguage', lang)
i18nSetLanguage(lang)
updateDocumentTitle()
}
</script>
......
......@@ -46,5 +46,6 @@
"fr": "Francès",
"es": "Espanyol",
"ca": "Català"
}
},
"appTitle": "Visualització de vots Ğ1"
}
......@@ -46,5 +46,6 @@
"fr": "French",
"es": "Spanish",
"ca": "Catalan"
}
},
"appTitle": "Ğ1 vote view"
}
......@@ -46,5 +46,6 @@
"fr": "Francés",
"es": "Español",
"ca": "Catalán"
}
},
"appTitle": "Vista de votos Ğ1"
}
......@@ -46,5 +46,6 @@
"fr": "Français",
"es": "Espagnol",
"ca": "Catalan"
}
},
"appTitle": "Visualisation des votes Ğ1"
}
......@@ -52,6 +52,7 @@ export interface Translation {
es: string
ca: string
}
appTitle: string
}
export const translations: Record<string, Translation> = {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment