diff --git a/src/modules/project/pages/components/FormMetadata.vue b/src/modules/project/pages/components/FormMetadata.vue index 843bb683b115257a72ecffb95f2954b8467fcb87..e0f8c8b27c744a4a2d42e219dd9c43aa09f97b7a 100644 --- a/src/modules/project/pages/components/FormMetadata.vue +++ b/src/modules/project/pages/components/FormMetadata.vue @@ -511,6 +511,10 @@ const visibilities = computed(() => projectStore.visibilities ?? []); const disciplines = computed(() => projectStore.disciplines ?? []); const disciplineLabel = computed(() => { let locale = i18n.locale.value; + // Ensure that the value of locale is a valid locale, otherwie the property for disciplineLabel will be inaccurate + if (i18n.availableLocales.includes(locale) === false) { + locale = i18n.fallbackLocale.value.toString(); + } locale = locale.charAt(0).toUpperCase() + locale.slice(1); return `displayName${locale}`; }); diff --git a/src/modules/project/pages/components/data-publication/DataPublicationProjectData.vue b/src/modules/project/pages/components/data-publication/DataPublicationProjectData.vue index 8a704e6e8c9060a5d28901f758ed1600ce58361c..e59258b7713ccf73eaf1add14003fb503a2d9ebd 100644 --- a/src/modules/project/pages/components/data-publication/DataPublicationProjectData.vue +++ b/src/modules/project/pages/components/data-publication/DataPublicationProjectData.vue @@ -285,6 +285,10 @@ export default defineComponent({ }, disciplineLabel(): string { let locale = this.$i18n.locale; + // Ensure that the value of locale is a valid locale, otherwie the property for disciplineLabel will be inaccurate + if (this.$i18n.availableLocales.includes(locale) === false) { + locale = this.$i18n.fallbackLocale.toString(); + } locale = locale.charAt(0).toUpperCase() + locale.slice(1); return `displayName${locale}`; }, diff --git a/src/modules/project/pages/components/data-publication/DataPublicationSummary.vue b/src/modules/project/pages/components/data-publication/DataPublicationSummary.vue index 09fd7f04bff02c7fb69483069d0fadcb08aa7614..25d8b0c4a7bfd695060d1c1b00c1e6cfcd7fbc24 100644 --- a/src/modules/project/pages/components/data-publication/DataPublicationSummary.vue +++ b/src/modules/project/pages/components/data-publication/DataPublicationSummary.vue @@ -180,6 +180,10 @@ export default defineComponent({ }, disciplineLabel(): string { let locale = this.$i18n.locale; + // Ensure that the value of locale is a valid locale, otherwie the property for disciplineLabel will be inaccurate + if (this.$i18n.availableLocales.includes(locale) === false) { + locale = this.$i18n.fallbackLocale.toString(); + } locale = locale.charAt(0).toUpperCase() + locale.slice(1); return `displayName${locale}`; }, diff --git a/src/modules/resource/components/create-resource/ResourceMetadata.vue b/src/modules/resource/components/create-resource/ResourceMetadata.vue index 10cd4b676a218206c5a0a306138b2f164c654eda..1289b5ac56224994aec4c7c40ee4fe32dfa7e71d 100644 --- a/src/modules/resource/components/create-resource/ResourceMetadata.vue +++ b/src/modules/resource/components/create-resource/ResourceMetadata.vue @@ -376,6 +376,10 @@ const disciplines = computed(() => { }); const disciplineLabel = computed(() => { let locale = i18n.locale.value; + // Ensure that the value of locale is a valid locale, otherwie the property for disciplineLabel will be inaccurate + if (i18n.availableLocales.includes(locale) === false) { + locale = i18n.fallbackLocale.value.toString(); + } locale = locale.charAt(0).toUpperCase() + locale.slice(1); return `displayName${locale}`; }); diff --git a/src/modules/user/pages/UserProfile.vue b/src/modules/user/pages/UserProfile.vue index d2b80684876db50fd5a9e62b1be35b6047b6695c..09c1d1bcf1686cf0d83123480aea435306c45ce8 100644 --- a/src/modules/user/pages/UserProfile.vue +++ b/src/modules/user/pages/UserProfile.vue @@ -476,11 +476,13 @@ export default defineComponent({ }, computed: { disciplineLabel(): string { - if (this.$i18n.locale === "en") { - return "displayNameEn"; - } else { - return "displayNameDe"; + let locale = this.$i18n.locale; + // Ensure that the value of locale is a valid locale, otherwie the property for disciplineLabel will be inaccurate + if (this.$i18n.availableLocales.includes(locale) === false) { + locale = this.$i18n.fallbackLocale.toString(); } + locale = locale.charAt(0).toUpperCase() + locale.slice(1); + return `displayName${locale}`; }, disciplines(): DisciplineDto[] { return this.userStore.userProfile.disciplines