How to get current language from Vue component?

I made a Vue component for the panel and I was hoping to show the current language in there, something like:

export default {
  template: `<div>
    {{currentLanguage}}
  </div>`
}

Obviously, this doesn’t work, but I’ve been trying all sorts of things and I can’t find out how to get the current language. I have found out how to get the list of all languages, with this.$api.get('languages'), and that even tells me which language is the default language, but I’m not finding any way to get the current language.

Could you try following code please?

this.$store.state.languages.current

Hello,
I think this doesn’t work anymore in the >3.6 Kirby installations, ‘state’ doesn’t have the languages property anymore… Is there a new way to find the current lan in the Vue plugin component, thanks!

Should be like that:

Current

this.$language

Default language

this.$languages.find((language) => language.default === true)

Languages

this.$languages
1 Like

This works, thank you very much!
Now that I’ve logged this.$language, I see the boolean property ‘default’, which also helps a great deal!
Cheers!