Add i18n translations. (#381)

* Initial prototype.

* Add support for i18n in more places.
This commit is contained in:
Kavin
2021-08-25 22:00:21 +05:30
committed by GitHub
parent 45f132e2b4
commit 4ae77badd8
12 changed files with 169 additions and 22 deletions

View File

@@ -58,6 +58,19 @@ export default {
window.db = e.target.result;
};
} else console.log("This browser doesn't support IndexedDB");
const App = this;
(async function() {
const locale = App.getPreferenceString("hl", "en");
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);
window.i18n.global.setLocaleMessage(locale, messages);
}
window.i18n.global.locale.value = locale;
}
})();
},
};
</script>