2017-02-08 19:13:14 +00:00
|
|
|
<template>
|
|
|
|
<div>
|
|
|
|
<header class="Header">
|
|
|
|
<div class="container">
|
|
|
|
<h1 class="Header__Title">Nuxt i18n</h1>
|
|
|
|
<nav class="Header__Menu">
|
2017-02-10 11:55:51 +00:00
|
|
|
<nuxt-link class="Header__Link" :to="path('/')" exact>
|
2017-02-09 23:45:36 +00:00
|
|
|
{{ $t('links.home') }}
|
2017-02-08 19:13:14 +00:00
|
|
|
</nuxt-link>
|
2017-05-31 11:21:55 +00:00
|
|
|
<nuxt-link class="Header__Link" :to="path('/about')" exact>
|
2017-02-09 23:45:36 +00:00
|
|
|
{{ $t('links.about') }}
|
2017-02-08 19:13:14 +00:00
|
|
|
</nuxt-link>
|
2017-04-14 09:55:04 +00:00
|
|
|
<nuxt-link class="Header__Link" v-if="$i18n.locale === 'en'" :to="`/fr` + $route.fullPath" active-class="none" exact>
|
2017-02-09 23:45:36 +00:00
|
|
|
{{ $t('links.french') }}
|
2017-02-08 19:13:14 +00:00
|
|
|
</nuxt-link>
|
2017-04-14 09:55:04 +00:00
|
|
|
<nuxt-link class="Header__Link" v-else :to="$route.fullPath.replace(/^\/[^\/]+/, '')" active-class="none" exact>
|
2017-02-09 23:45:36 +00:00
|
|
|
{{ $t('links.english') }}
|
2017-02-08 23:46:52 +00:00
|
|
|
</nuxt-link>
|
2017-02-08 19:13:14 +00:00
|
|
|
</nav>
|
|
|
|
</div>
|
|
|
|
</header>
|
|
|
|
<nuxt/>
|
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
|
|
|
export default {
|
|
|
|
methods: {
|
2017-10-31 13:43:55 +00:00
|
|
|
path(url) {
|
2017-04-14 09:55:04 +00:00
|
|
|
return (this.$i18n.locale === 'en' ? url : '/' + this.$i18n.locale + url)
|
2017-02-08 19:13:14 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<style>
|
2017-04-14 09:55:04 +00:00
|
|
|
*, *:before, *:after {
|
|
|
|
padding: 0;
|
|
|
|
margin: 0;
|
|
|
|
box-sizing: border-box;
|
|
|
|
}
|
|
|
|
html, body {
|
2017-02-08 19:13:14 +00:00
|
|
|
background-color: #fff;
|
|
|
|
color: #2e2f30;
|
|
|
|
letter-spacing: 0.5px;
|
|
|
|
font-size: 18px;
|
|
|
|
font-family: "Source Sans Pro", Arial, sans-serif;
|
|
|
|
height: 100vh;
|
|
|
|
margin: 0;
|
|
|
|
}
|
2017-04-14 09:55:04 +00:00
|
|
|
.container {
|
2017-02-08 19:13:14 +00:00
|
|
|
width: 75%;
|
|
|
|
margin: 0 auto;
|
|
|
|
}
|
2017-04-14 09:55:04 +00:00
|
|
|
.container:after {
|
2017-02-08 19:13:14 +00:00
|
|
|
content: "";
|
|
|
|
display: table;
|
|
|
|
clear: both;
|
|
|
|
}
|
2017-04-14 09:55:04 +00:00
|
|
|
.Header {
|
2017-02-08 19:13:14 +00:00
|
|
|
color: #fff;
|
|
|
|
height: 80px;
|
|
|
|
line-height: 80px;
|
|
|
|
background-color: #2e2f30;
|
|
|
|
}
|
2017-04-14 09:55:04 +00:00
|
|
|
.Header__Title {
|
2017-02-08 19:13:14 +00:00
|
|
|
float: left;
|
|
|
|
font-weight: 300;
|
|
|
|
font-size: 30px;
|
|
|
|
}
|
2017-04-14 09:55:04 +00:00
|
|
|
.Header__Menu {
|
2017-02-08 19:13:14 +00:00
|
|
|
float: right;
|
|
|
|
}
|
2017-04-14 09:55:04 +00:00
|
|
|
.Header__Link {
|
2017-02-08 19:13:14 +00:00
|
|
|
font-size: 16px;
|
|
|
|
color: #fff;
|
|
|
|
border: 1px solid #fff;
|
|
|
|
padding: 7px 12px;
|
|
|
|
text-transform: uppercase;
|
|
|
|
text-decoration: none;
|
|
|
|
border-radius: 5px;
|
|
|
|
margin-left: 10px;
|
|
|
|
}
|
2017-04-14 09:55:04 +00:00
|
|
|
.Header__Link:hover {
|
2017-02-08 19:13:14 +00:00
|
|
|
color: #2e2f30;
|
|
|
|
background-color: #fff;
|
|
|
|
}
|
2017-02-10 11:55:51 +00:00
|
|
|
.nuxt-link-active {
|
|
|
|
color: cyan;
|
|
|
|
}
|
2017-04-14 09:55:04 +00:00
|
|
|
.Content {
|
|
|
|
padding: 50px 0;
|
|
|
|
text-align: center;
|
|
|
|
}
|
|
|
|
.Content__Title {
|
|
|
|
font-weight: 300;
|
|
|
|
padding-bottom: 30px;
|
|
|
|
}
|
2017-02-08 19:13:14 +00:00
|
|
|
</style>
|