Answer the question
In order to leave comments, you need to log in
How to properly set up multilingualism for a project on NUXT VUE?
Hello, I'm doing a project, Beck is on my laravel and for the front I tried to use nuxt for the first time.
Larvel gives api json like this.
{
"menu_id": 1,
"menu_item__id": 1,
"menu_item_title_ru": "Главная",
"menu_item_title_uk": "Головна",
"menu_item_path": "/",
"menu_item_icon": null,
"menu_item_parent_id": 1,
"menu_item_status": "1"
},
{
"menu_item_id": 2,
"menu_item_menu_id": 1,
"menu_item_title_ru": "Контакты",
"menu_item_title_uk": "Контакти",
"menu_item_path": "/contacts",
"menu_item_icon": null,
"menu_item_parent_id": 1,
"menu_item_status": "1"
},
<nuxt-link
:to="item.menu_item_path">
<span v-if="$i18n.locale === 'ru'">{{item.menu_item_title_ru}}</span>
<span v-else>{{item.menu_item_title_uk}}</span>
</nuxt-link>
Answer the question
In order to leave comments, you need to log in
And if so?
<span>{{item[`menu_item_title_${$i18n.locale}`]}}</span>
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question