feat(localization): add vr.pug

This commit is contained in:
kamiya10
2022-12-31 19:10:52 +08:00
parent 25c9a2a637
commit b12a7327bb
4 changed files with 83 additions and 16 deletions
+43
View File
@@ -8,10 +8,12 @@ import '@fontsource/noto-sans-kr';
import '@fontsource/noto-sans-jp';
import Noty from 'noty';
import Vue from 'vue';
import VueI18n from 'vue-i18n';
import ElementUI from 'element-ui';
import locale from 'element-ui/lib/locale/lang/en';
import * as workerTimers from 'worker-timers';
import MarqueeText from 'vue-marquee-text-component';
import * as localizedStrings from './localization/localizedStrings.js';
Vue.component('marquee-text', MarqueeText);
(async function () {
@@ -29,6 +31,14 @@ Vue.component('marquee-text', MarqueeText);
timeout: 3000
});
Vue.use(VueI18n);
var i18n = new VueI18n({
locale: 'en',
fallbackLocale: 'en',
messages: localizedStrings
});
Vue.use(ElementUI, {
locale
});
@@ -163,6 +173,7 @@ Vue.component('marquee-text', MarqueeText);
};
var $app = {
i18n,
data: {
// 1 = 대시보드랑 손목에 보이는거
// 2 = 항상 화면에 보이는 거
@@ -675,6 +686,38 @@ Vue.component('marquee-text', MarqueeText);
Vue.filter('formatDate', formatDate);
};
// App: Language
$app.data.appLanguage = 'en';
/*
if (configRepository.getString('VRCX_appLanguage')) {
$app.data.appLanguage = configRepository.getString('VRCX_appLanguage');
i18n.locale = $app.data.appLanguage;
} else {
AppApi.CurrentLanguage().then((result) => {
if (!result) {
console.error('Failed to get current language');
$app.changeAppLanguage('en');
return;
}
var lang = result.split('-')[0];
i18n.availableLocales.forEach((ref) => {
var refLang = ref.split('_')[0];
if (refLang === lang) {
$app.changeAppLanguage(ref);
}
});
});
}
$app.methods.changeAppLanguage = function (language) {
console.log('Language changed:', language);
this.appLanguage = language;
i18n.locale = language;
configRepository.setString('VRCX_appLanguage', language);
};
*/
$app = new Vue($app);
window.$app = $app;
})();