From ffecaee7bc8d77e37f50e0f15aaca2bca3643aba Mon Sep 17 00:00:00 2001 From: Quique Fdez Guerra Date: Fri, 1 Dec 2017 13:33:33 +0100 Subject: [PATCH 1/5] Add link to easy use on templates --- examples/i18n/plugins/i18n.js | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/examples/i18n/plugins/i18n.js b/examples/i18n/plugins/i18n.js index e4859aadc..6940eef00 100644 --- a/examples/i18n/plugins/i18n.js +++ b/examples/i18n/plugins/i18n.js @@ -14,4 +14,12 @@ export default ({ app, store }) => { 'fr': require('~/locales/fr.json') } }) + + app.i18n.link = (link) => { + if (app.i18n.locale === app.i18n.fallbackLocale) { + return `/${link}` + } + + return `/${app.i18n.locale}/${link}` + } } From 68b06853392f1e733d488f435f64f327d32eda9d Mon Sep 17 00:00:00 2001 From: Quique Fdez Guerra Date: Fri, 1 Dec 2017 13:38:22 +0100 Subject: [PATCH 2/5] Add path method from i18n (custom) --- examples/i18n/layouts/default.vue | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/examples/i18n/layouts/default.vue b/examples/i18n/layouts/default.vue index 8bf6defab..cb2254cff 100644 --- a/examples/i18n/layouts/default.vue +++ b/examples/i18n/layouts/default.vue @@ -4,10 +4,10 @@

Nuxt i18n