From 2cb4359ffd784b1be16fa52b8f135978db377629 Mon Sep 17 00:00:00 2001 From: lesion Date: Wed, 12 Oct 2022 12:45:09 +0200 Subject: [PATCH] move to nuxt-i18n, switch language,address #171 --- components/Calendar.vue | 6 +++++- components/Nav.vue | 18 ++++++++++++++++-- components/admin/Settings.vue | 2 +- locales/en.json | 3 ++- locales/esm.js | 13 ------------- locales/index.js | 12 ++++++------ locales/it.json | 3 ++- nuxt.config.js | 20 +++++++++++++++++++- package.json | 2 +- plugins/filters.js | 13 ++++++------- server/helpers.js | 7 ------- server/routes.js | 4 +--- store/index.js | 4 ---- 13 files changed, 59 insertions(+), 48 deletions(-) delete mode 100644 locales/esm.js diff --git a/components/Calendar.vue b/components/Calendar.vue index 6b15fa4c..1f7a42a2 100644 --- a/components/Calendar.vue +++ b/components/Calendar.vue @@ -41,7 +41,11 @@ export default { }, methods: { updatePage (page) { - this.$emit('monthchange', page) + if (page.month !== this.page.month || page.year !== this.page.year) { + this.$emit('monthchange', page) + this.page.month = page.month + this.page.year = page.year + } }, click (day) { this.$emit('dayclick', day) diff --git a/components/Nav.vue b/components/Nav.vue index f3ec571c..63765c0e 100644 --- a/components/Nav.vue +++ b/components/Nav.vue @@ -21,7 +21,7 @@ v-app-bar(app aria-label='Menu' height=64) v-icon(v-text='mdiLogin') client-only - v-menu(v-if='loggedIn' offset-y eager) + v-menu(v-if='loggedIn' offset-y transition="slide-y-transition") template(v-slot:activator="{ on, attrs }") v-btn(icon v-bind='attrs' v-on='on' title='Menu' aria-label='Menu') v-icon(v-text='mdiDotsVertical') @@ -47,12 +47,26 @@ v-app-bar(app aria-label='Menu' height=64) v-btn(v-if='loggedIn' icon aria-label='Menu' title='Menu') v-icon(v-text='mdiDotsVertical') + client-only + v-menu(offset-y transition="slide-y-transition" min-width='200px' max-height='400px') + template(v-slot:activator="{ on, attrs }") + v-btn(icon v-bind='attrs' v-on='on' aria-label='Language') {{$i18n.locale}} + v-list + v-list-item(v-for='locale in $i18n.locales' @click.prevent.stop="$i18n.setLocale(locale.code)" :key='locale.code') + v-list-item-content + v-list-item-title {{locale.name}} + v-list-item(nuxt target='_blank' href='https://hosted.weblate.org/engage/gancio/') + v-list-item-content + v-list-item-subtitle(v-text='$t("common.help_translate")') + template(#placeholder) + v-btn(icon aria-label='Language') {{$i18n.locale}} v-btn(icon target='_blank' :href='`${settings.baseurl}/feed/rss`' title='RSS' aria-label='RSS') v-icon(color='orange' v-text='mdiRss')