Static GitHub Issues

[809] Custom routes with i18n

prev: Separate .vue into html, js and css files
next: Question: how to make route parameter required?

Hi there,

I would like to add routes to my application with data coming from a json file, and on my application using the i18n example .

On the root page, my code looks like this :

<nuxt-link :to="element.id" class="work" >
  <div class="desc">
    <h3>{{ element.name }}</h3>
     <span>{{ element.description }}</span>
  </div>
</nuxt-link>
data() {
  return {
     portfolioElements: this.$i18n.t('portfolio')
  }
}

And, on my _id.vue page, the code looks like this

async asyncData ({ params }) {
  return {
    portfolioElements: this.$i18n.t('portfolio')[0]
  }
}

I know this should be wrong, but I'm not sure how to implement routes using the _lang attribute as well! Any help would be appreciated

Thanks

<!--cmty--><!--cmty_prevent_hook--><div align="right"><sub><em>This question is available on <a href="https://nuxtjs.cmty.io">Nuxt.js</a> community (<a href="https://nuxtjs.cmty.io/nuxt/nuxt.js/issues/c695">#c695</a>)</em></sub></div>