Update i18n example

This commit is contained in:
Sébastien Chopin 2017-02-10 00:45:36 +01:00
parent 13284fbf8a
commit d698cb4dca
5 changed files with 32 additions and 19 deletions

View File

@ -5,16 +5,16 @@
<h1 class="Header__Title">Nuxt i18n</h1> <h1 class="Header__Title">Nuxt i18n</h1>
<nav class="Header__Menu"> <nav class="Header__Menu">
<nuxt-link class="Header__Link" :to="path('/')"> <nuxt-link class="Header__Link" :to="path('/')">
{{ $t('message.home') }} {{ $t('links.home') }}
</nuxt-link> </nuxt-link>
<nuxt-link class="Header__Link" :to="path('/about')"> <nuxt-link class="Header__Link" :to="path('/about')">
{{ $t('message.about') }} {{ $t('links.about') }}
</nuxt-link> </nuxt-link>
<nuxt-link class="Header__Link" v-if="$store.state.lang.lang === 'en'" to="/fr"> <nuxt-link class="Header__Link" v-if="$store.state.lang.lang === 'en'" to="/fr">
{{ $t('message.french') }} {{ $t('links.french') }}
</nuxt-link> </nuxt-link>
<nuxt-link class="Header__Link" v-else to="/"> <nuxt-link class="Header__Link" v-else to="/">
{{ $t('message.english') }} {{ $t('links.english') }}
</nuxt-link> </nuxt-link>
</nav> </nav>
</div> </div>

View File

@ -1,7 +1,8 @@
<template> <template>
<div class="Content"> <div class="Content">
<div class="container"> <div class="container">
<h1 class="Content__Title">{{ $t('message.about') }}</h1> <h1 class="Content__Title">{{ $t('about.title') }}</h1>
<p>{{ $t('about.introduction') }}</p>
</div> </div>
</div> </div>
</template> </template>

View File

@ -1,8 +1,8 @@
<template> <template>
<div class="Content"> <div class="Content">
<div class="container"> <div class="container">
<h1 class="Content__Title">{{ $t('message.welcome') }}</h1> <h1 class="Content__Title">{{ $t('home.title') }}</h1>
<p>{{ $t('message.introduction') }}</p> <p>{{ $t('home.introduction') }}</p>
</div> </div>
</div> </div>
</template> </template>

View File

@ -1,10 +1,16 @@
{ {
"message": { "links": {
"english": "English version",
"french": "French version",
"welcome": "Welcome",
"introduction": "This is an introduction in English.",
"home": "Home", "home": "Home",
"about": "About" "about": "About",
"english": "English version",
"french": "French version"
},
"home": {
"title": "Welcome",
"introduction": "This is an introduction in English."
},
"about": {
"title": "About",
"introduction": "This page is made to give you more informations."
} }
} }

View File

@ -1,10 +1,16 @@
{ {
"message": { "links": {
"english": "Version Anglaise",
"french": "Version Française",
"welcome": "Bienvenue",
"introduction": "Ceci est un texte d'introduction en Français.",
"home": "Accueil", "home": "Accueil",
"about": "À propos" "about": "À propos",
"english": "Version Anglaise",
"french": "Version Française"
},
"home": {
"title": "Bienvenue",
"introduction": "Ceci est un texte d'introduction en Français."
},
"about": {
"title": "À propos",
"introduction": "Cette page est faite pour vous donner plus d'informations."
} }
} }