add multilanguage support and add russian language

This commit is contained in:
cany748 2022-06-11 15:30:09 +07:00
parent bbd19b7a6f
commit ceacaa9e3c
6 changed files with 134 additions and 38 deletions

View file

@ -23,8 +23,15 @@ function bytes(bytes, decimals, kib, maxunit) {
return `${parseFloat((bytes / Math.pow(k, i)).toFixed(dm))} ${sizes[i]}`;
}
const i18n = new VueI18n({
locale: localStorage.getItem('lang') || 'en',
fallbackLocale: 'en',
messages,
});
new Vue({
el: '#app',
i18n,
components: {
apexchart: VueApexCharts,
},
@ -48,6 +55,8 @@ new Vue({
currentRelease: null,
latestRelease: null,
langDropdownShow: false,
chartOptions: {
chart: {
background: 'transparent',
@ -243,11 +252,15 @@ new Vue({
.catch(err => alert(err.message || err.toString()))
.finally(() => this.refresh().catch(console.error));
},
changeLang(lang) {
localStorage.setItem('lang', lang);
i18n.locale = lang;
},
},
filters: {
bytes,
timeago: value => {
return timeago().format(value);
return timeago.format(value, i18n.locale);
},
},
mounted() {