Skip to content

Commit e2f196c

Browse files
authored
Merge pull request #448 from dnum-mi/fix/improve-dsfr-language-selector-api
fix: 🐛 Afficher le code ISO de la langue courante sur le bouton
2 parents b9affd4 + 2b0210a commit e2f196c

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/components/DsfrLanguageSelector/DsfrLanguageSelector.vue

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,9 @@ export default defineComponent({
3838
}
3939
return baseStyle
4040
},
41+
currentLanguageObject () {
42+
return this.languages.find(({ codeIso }) => codeIso === this.currentLanguage)
43+
},
4144
},
4245
watch: {
4346
expanded (isExpanded) {
@@ -71,7 +74,7 @@ export default defineComponent({
7174
type="button"
7275
@click.prevent.stop="expanded = !expanded"
7376
>
74-
{{ languages[0].codeIso.toUpperCase() }}<span class="fr-hidden-lg">&nbsp;- {{ languages[0].label }}</span>
77+
{{ currentLanguageObject.codeIso.toUpperCase() }}<span class="fr-hidden-lg">&nbsp;- {{ currentLanguageObject.label }}</span>
7578
</button>
7679
<div
7780
:id="id"

0 commit comments

Comments
 (0)