feat: use vue-i18n 9 for vue3

This commit is contained in:
Dominik Pschenitschni 2021-08-20 15:38:16 +02:00
parent 3d6aca3510
commit 7c3c2945f8
No known key found for this signature in database
GPG key ID: B257AC0149F43A77
19 changed files with 123 additions and 71 deletions

View file

@ -11,7 +11,7 @@ declare global {
}
}
import {formatDate, formatDateSince} from '@/helpers/time/formatDate'
import {formatDateShort, formatDateLong, formatDateSince} from '@/helpers/time/formatDate'
// @ts-ignore
import {VERSION} from './version.json'
@ -28,8 +28,7 @@ import vueShortkey from 'vue-shortkey'
// Vuex
import {store} from './store'
// i18n
import VueI18n from 'vue-i18n' // types
import {i18n} from './i18n/setup'
import {i18n} from './i18n'
console.info(`Vikunja frontend version ${VERSION}`)
@ -77,30 +76,19 @@ app.component('modal', Modal)
app.component('card', Card)
// Mixins
import message from './message'
import {getNamespaceTitle} from './helpers/getNamespaceTitle'
import {getListTitle} from './helpers/getListTitle'
import {colorIsDark} from './helpers/color/colorIsDark'
import {setTitle} from './helpers/setTitle'
app.mixin({
methods: {
formatDateSince(date) {
return formatDateSince(date, (p: VueI18n.Path, params?: VueI18n.Values) => this.$t(p, params))
},
formatDate(date) {
return formatDate(date, 'PPPPpppp', this.$t('date.locale'))
},
formatDateShort(date) {
return formatDate(date, 'PPpp', this.$t('date.locale'))
},
getNamespaceTitle(n) {
return getNamespaceTitle(n, (p: VueI18n.Path) => this.$t(p))
},
getListTitle(l) {
return getListTitle(l, (p: VueI18n.Path) => this.$t(p))
},
colorIsDark: colorIsDark,
setTitle: setTitle,
formatDateSince,
formatDate: formatDateLong,
formatDateShort: formatDateShort,
getNamespaceTitle,
getListTitle,
colorIsDark,
setTitle,
},
})