I am working with a JSON table:
[
{
"fr": { "name": "chien", "name_plurial": "chiens" },
"en": { "name": "dog", "name_plurial": "dogs" }
},
{
"fr": { "name": "chat", "name_plurial": "chats" },
"en": { "name": "cat", "name_plurial": "cats" }
},
]
In my .vue file, I import this data and use v-for to display it:
<template>
<div>
v-for="(specie, index) in species"
:key="index"
:label="specie.en.name | capitalize"
:value="specie.en.name">
</div>
</template>
import Species from '~/static/data/species.json'
export default {
data() {
return {
species: Species,
}
},
}
Now, I want to dynamically retrieve the locale based on the language of my user user.lang
.
Can you help me achieve this?
Thank you!