Skip to content

Commit

Permalink
FIX affichage des titres non francais quand la version fr est absente
Browse files Browse the repository at this point in the history
  • Loading branch information
clementdelafontaine committed Dec 9, 2024
1 parent b9d54d0 commit 5d4464d
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 9 deletions.
16 changes: 12 additions & 4 deletions components/common/LanguageSelector.vue
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,22 @@ const props = defineProps({
}
});
const current = ref("fr");
const current = ref(
props.languages.includes("fr")
? "fr" // Si "fr" est présent dans props.languages
: props.languages[0] // Sinon, prendre le premier langage disponible
);
//Tri des langues dans l'ordre alpha + FR au début
const langList = computed(() => {
const list = props.languages;
list.sort().splice(list.indexOf("fr"), 1);
const list = [...props.languages];
list.sort();
if (list.includes("fr")) {
list.splice(list.indexOf("fr"), 1);
list.unshift("fr");
return list;
}
return list;
});
const emit = defineEmits(['updateLangue']);
Expand Down
12 changes: 7 additions & 5 deletions components/theses/ThesisTitle.vue
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,16 @@ const props = defineProps({
}
});
const currentTitle = ref("");
const selectedLanguage = ref("fr");
const isRtl = ref(false);
currentTitle.value = props.titles[selectedLanguage.value];
const currentTitle = computed(() => {
// Si pas de fr, utiliser la première langue disponible
if (!props.titles[selectedLanguage.value]) {
selectedLanguage.value = Object.keys(props.titles)[0];
}
return props.titles[selectedLanguage.value];
});
const firstFocusElement = ref(null);
Expand All @@ -51,13 +56,10 @@ onMounted(() => {
/**
* Computed Properties
*/
const langList = computed(() => {
return Object.keys(props.titles);
});
/**
* Functions
* */
Expand Down

0 comments on commit 5d4464d

Please sign in to comment.