From 5a7bbf9d9ca3bcd6360a42ec667d035892e9c9db Mon Sep 17 00:00:00 2001 From: Joyelle Ndagijimana Date: Thu, 6 Mar 2025 13:36:54 +0100 Subject: [PATCH] feat(frontend): 'en' en 'nl' vertalingen zijn nu beschikbaar via de menubalk. --- frontend/src/components/MenuBar.vue | 14 +++++++++----- frontend/src/i18n/i18n.ts | 25 +++++++++++++------------ frontend/src/i18n/locale/de.json | 3 +++ frontend/src/i18n/locale/en.json | 9 +++++++++ frontend/src/i18n/locale/fr.json | 3 +++ frontend/src/i18n/locale/nl.json | 9 +++++++++ frontend/src/i18n/locales/de.json | 0 frontend/src/i18n/locales/en.json | 0 frontend/src/i18n/locales/fr.json | 0 frontend/src/i18n/locales/nl.json | 0 10 files changed, 46 insertions(+), 17 deletions(-) create mode 100644 frontend/src/i18n/locale/de.json create mode 100644 frontend/src/i18n/locale/en.json create mode 100644 frontend/src/i18n/locale/fr.json create mode 100644 frontend/src/i18n/locale/nl.json delete mode 100644 frontend/src/i18n/locales/de.json delete mode 100644 frontend/src/i18n/locales/en.json delete mode 100644 frontend/src/i18n/locales/fr.json delete mode 100644 frontend/src/i18n/locales/nl.json diff --git a/frontend/src/components/MenuBar.vue b/frontend/src/components/MenuBar.vue index fe2b3563..e6d6df5d 100644 --- a/frontend/src/components/MenuBar.vue +++ b/frontend/src/components/MenuBar.vue @@ -2,8 +2,10 @@ import { ref } from "vue"; import { useRoute } from "vue-router"; import dwengoLogo from "../../../assets/img/dwengo-groen-zwart.svg"; + import {useI18n} from "vue-i18n"; const route = useRoute(); + const { t, locale } = useI18n() // Instantiate variables to use in html to render right // Links and content dependent on the role (student or teacher) @@ -27,6 +29,8 @@ // Logic to change the language of the website to the selected language const changeLanguage = (langCode: string) => { + locale.value = langCode; + localStorage.setItem('user-lang', langCode); console.log(langCode); }; @@ -46,7 +50,7 @@ :src="dwengoLogo" />

- {{ role }} + {{ t(`${role}`) }}

@@ -55,21 +59,21 @@ :to="`/${role}/${userId}/assignment`" class="menu_item" > - assignments + {{ t('assignments') }}
  • classes{{ t('classes') }}
  • discussions{{ t('discussions') }}
  • @@ -104,7 +108,7 @@