mirror of
https://github.com/advplyr/audiobookshelf.git
synced 2024-11-07 16:44:16 +01:00
localized date-fns library
This commit is contained in:
parent
030c20b12e
commit
e8d582269b
@ -73,6 +73,8 @@ async function loadi18n(code) {
|
||||
for (const key in Vue.prototype.$strings) {
|
||||
Vue.prototype.$strings[key] = strings[key] || translations[defaultCode][key]
|
||||
}
|
||||
console.log(`ConfigDateFnsLocale = ${translations[code].ConfigDateFnsLocale}`)
|
||||
Vue.prototype.$setDateFnsLocale(translations[code].ConfigDateFnsLocale)
|
||||
|
||||
console.log('i18n strings=', Vue.prototype.$strings)
|
||||
Vue.prototype.$eventBus.$emit('change-lang', code)
|
||||
|
@ -1,10 +1,26 @@
|
||||
import Vue from 'vue'
|
||||
import Path from 'path'
|
||||
import vClickOutside from 'v-click-outside'
|
||||
import { formatDistance, format, addDays, isDate } from 'date-fns'
|
||||
import { formatDistance, format, addDays, isDate, setDefaultOptions } from 'date-fns'
|
||||
import { de as localeDE, enUS as localeENUS, es as localeES, fr as localeFR, hr as localeHR, it as localeIT, pl as localePL, zhCN as localeZNCN } from 'date-fns/locale'
|
||||
let locale = {
|
||||
de: localeDE,
|
||||
enUS: localeENUS,
|
||||
es: localeES,
|
||||
fr: localeFR,
|
||||
hr: localeHR,
|
||||
it: localeIT,
|
||||
pl: localePL,
|
||||
znCN: localeZNCN
|
||||
}
|
||||
|
||||
Vue.directive('click-outside', vClickOutside.directive)
|
||||
|
||||
|
||||
Vue.prototype.$setDateFnsLocale = (localeString) => {
|
||||
if (!locale[localeString]) return 0
|
||||
return setDefaultOptions({locale: locale[localeString]})
|
||||
}
|
||||
Vue.prototype.$dateDistanceFromNow = (unixms) => {
|
||||
if (!unixms) return ''
|
||||
return formatDistance(unixms, Date.now(), { addSuffix: true })
|
||||
|
@ -80,6 +80,7 @@
|
||||
"ButtonUserEdit": "Benutzer {0} bearbeiten",
|
||||
"ButtonViewAll": "Alles anzeigen",
|
||||
"ButtonYes": "Ja",
|
||||
"ConfigDateFnsLocale": "de",
|
||||
"HeaderAccount": "Konto",
|
||||
"HeaderAdvanced": "Erweitert",
|
||||
"HeaderAppriseNotificationSettings": "Apprise Benachrichtigungseinstellungen",
|
||||
|
@ -80,6 +80,7 @@
|
||||
"ButtonUserEdit": "Edit user {0}",
|
||||
"ButtonViewAll": "View All",
|
||||
"ButtonYes": "Yes",
|
||||
"ConfigDateFnsLocale": "enUS",
|
||||
"HeaderAccount": "Account",
|
||||
"HeaderAdvanced": "Advanced",
|
||||
"HeaderAppriseNotificationSettings": "Apprise Notification Settings",
|
||||
|
@ -80,6 +80,7 @@
|
||||
"ButtonUserEdit": "Edit user {0}",
|
||||
"ButtonViewAll": "View All",
|
||||
"ButtonYes": "Yes",
|
||||
"ConfigDateFnsLocale": "es",
|
||||
"HeaderAccount": "Account",
|
||||
"HeaderAdvanced": "Advanced",
|
||||
"HeaderAppriseNotificationSettings": "Apprise Notification Settings",
|
||||
|
@ -80,6 +80,7 @@
|
||||
"ButtonUserEdit": "Modifier l'utilisateur {0}",
|
||||
"ButtonViewAll": "Afficher Tout",
|
||||
"ButtonYes": "Oui",
|
||||
"ConfigDateFnsLocale": "fr",
|
||||
"HeaderAccount": "Compte",
|
||||
"HeaderAdvanced": "Avancé",
|
||||
"HeaderAppriseNotificationSettings": "Configuration des Notifications Apprise",
|
||||
|
@ -80,6 +80,7 @@
|
||||
"ButtonUserEdit": "Edit user {0}",
|
||||
"ButtonViewAll": "Prikaži sve",
|
||||
"ButtonYes": "Da",
|
||||
"ConfigDateFnsLocale": "hr",
|
||||
"HeaderAccount": "Korisnički račun",
|
||||
"HeaderAdvanced": "Napredno",
|
||||
"HeaderAppriseNotificationSettings": "Apprise Notification Settings",
|
||||
|
@ -80,6 +80,7 @@
|
||||
"ButtonUserEdit": "Modifica Utente {0}",
|
||||
"ButtonViewAll": "Mostra Tutto",
|
||||
"ButtonYes": "Si",
|
||||
"ConfigDateFnsLocale": "it",
|
||||
"HeaderAccount": "Account",
|
||||
"HeaderAdvanced": "Avanzate",
|
||||
"HeaderAppriseNotificationSettings": "Apprendi le impostazioni di Notifica",
|
||||
|
@ -80,6 +80,7 @@
|
||||
"ButtonUserEdit": "Edit user {0}",
|
||||
"ButtonViewAll": "Zobacz wszystko",
|
||||
"ButtonYes": "Tak",
|
||||
"ConfigDateFnsLocale": "pl",
|
||||
"HeaderAccount": "Konto",
|
||||
"HeaderAdvanced": "Zaawansowane",
|
||||
"HeaderAppriseNotificationSettings": "Ustawienia powiadomień Apprise",
|
||||
|
@ -80,6 +80,7 @@
|
||||
"ButtonUserEdit": "编辑用户 {0}",
|
||||
"ButtonViewAll": "查看全部",
|
||||
"ButtonYes": "确定",
|
||||
"ConfigDateFnsLocale": "znCN",
|
||||
"HeaderAccount": "帐户",
|
||||
"HeaderAdvanced": "高级",
|
||||
"HeaderAppriseNotificationSettings": "测试通知设置",
|
||||
|
Loading…
Reference in New Issue
Block a user