From a5b5b94b431a2652f16e42aacdeb002457c5ec03 Mon Sep 17 00:00:00 2001 From: FireMaskterK <20838718+FireMasterK@users.noreply.github.com> Date: Wed, 27 Oct 2021 01:59:03 +0100 Subject: [PATCH] Localize feed TimeAgo. Partially fixes #554. --- src/App.vue | 7 +++++++ src/main.js | 6 ++++++ 2 files changed, 13 insertions(+) diff --git a/src/App.vue b/src/App.vue index 28803eaa..2de60b3e 100644 --- a/src/App.vue +++ b/src/App.vue @@ -63,6 +63,13 @@ export default { (async function() { const locale = App.getPreferenceString("hl", App.defaultLangage); + if (locale !== App.TimeAgoConfig.locale) { + const localeTime = await import("javascript-time-ago/locale/" + locale + ".json").then( + module => module.default, + ); + App.TimeAgo.addLocale(localeTime); + App.TimeAgoConfig.locale = locale; + } if (window.i18n.global.locale.value !== locale) { if (!window.i18n.global.availableLocales.includes(locale)) { const messages = await import("@/locales/" + locale + ".json").then(module => module.default); diff --git a/src/main.js b/src/main.js index d4bb12fa..e405d549 100644 --- a/src/main.js +++ b/src/main.js @@ -225,6 +225,12 @@ const mixin = { return "en"; }, }, + data() { + return { + TimeAgo: TimeAgo, + TimeAgoConfig: timeAgo, + }; + }, }; const i18n = createI18n({