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

View File

@@ -1360,5 +1360,17 @@
"count": "Count",
"action": "Action"
}
},
"vr": {
"status": {
"timer": "Timer:",
"players": "Players:",
"cpu": "CPU:",
"online": "Online:",
"devices": {
"left": "L:",
"right": "R:"
}
}
}
}

View File

@@ -1360,5 +1360,17 @@
"count": "次數",
"action": "動作"
}
},
"vr": {
"status": {
"timer": "時長:",
"players": "玩家人數:",
"cpu": "CPU",
"online": "線上:",
"devices": {
"left": "左:",
"right": "右:"
}
}
}
}

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;
})();

View File

@@ -30,14 +30,14 @@ html
.detail
span.extra
span.time {{ feed.created_at | formatDate }}
| #[span.name(v-text="feed.displayName")] ✔
| #[span.name(v-text="feed.displayName")] ✔
template(v-if="feed.worldName")
| #[location(:location="feed.location" :hint="feed.worldName")]
div(v-else-if="feed.type === 'Status'" class="x-friend-item" :class="{ friend: feed.isFriend, favorite: feed.isFavorite }")
.detail
span.extra
span.time {{ feed.created_at | formatDate }}
| #[span.name(v-text="feed.displayName")]
| #[span.name(v-text="feed.displayName")]
template(v-if="feed.statusDescription === feed.previousStatusDescription")
i.x-user-status(:class="statusClass(feed.previousStatus)")
i.el-icon-right
@@ -69,7 +69,7 @@ html
.detail
span.extra
span.time {{ feed.created_at | formatDate }}
| 🎵 #[span.name(v-text="feed.displayName")]
| 🎵 #[span.name(v-text="feed.displayName")]
template(v-if="feed.videoName")
| #[span(v-text="feed.videoName")]
template(v-else)
@@ -144,7 +144,7 @@ html
span.extra
span.time {{ feed.created_at | formatDate }}
template(v-if="feed.displayName")
| ✨ #[span.name(v-text="feed.displayName")]
| ✨ #[span.name(v-text="feed.displayName")]
| #[location(:location="feed.instanceId" :hint="feed.worldName")]
template(v-else)
| ✨ User has spawned a portal
@@ -152,7 +152,7 @@ html
.detail
span.extra
span.time {{ feed.created_at | formatDate }}
| 🧍 #[span.name(v-text="feed.displayName")]
| 🧍 #[span.name(v-text="feed.displayName")]
template(v-if="feed.releaseStatus === 'public'")
| #[i.x-user-status.online]
template(v-else)
@@ -229,14 +229,14 @@ html
.detail
span.extra
span.time {{ feed.created_at | formatDate }}
| #[span.name(v-text="feed.displayName")] has logged in
| #[span.name(v-text="feed.displayName")] has logged in
template(v-if="feed.worldName")
| to #[location(:location="feed.location" :hint="feed.worldName")]
div(v-else-if="feed.type === 'Status'" class="x-friend-item" :class="{ friend: feed.isFriend, favorite: feed.isFavorite }")
.detail
span.extra
span.time {{ feed.created_at | formatDate }}
| #[span.name(v-text="feed.displayName")]
| #[span.name(v-text="feed.displayName")]
template(v-if="feed.statusDescription === feed.previousStatusDescription")
i.x-user-status(:class="statusClass(feed.previousStatus)")
i.el-icon-right
@@ -267,7 +267,7 @@ html
.detail
span.extra
span.time {{ feed.created_at | formatDate }}
| #[span.name(v-text="feed.displayName")] changed video to
| #[span.name(v-text="feed.displayName")] changed video to
template(v-if="feed.videoName")
| #[span(v-text="feed.videoName")]
template(v-else)
@@ -342,7 +342,7 @@ html
span.extra
span.time {{ feed.created_at | formatDate }}
template(v-if="feed.displayName")
| #[span.name(v-text="feed.displayName")] has spawned a portal to
| #[span.name(v-text="feed.displayName")] has spawned a portal to
| #[location(:location="feed.instanceId" :hint="feed.worldName")]
template(v-else)
| User has spawned a portal
@@ -350,7 +350,7 @@ html
.detail
span.extra
span.time {{ feed.created_at | formatDate }}
| #[span.name(v-text="feed.displayName")] changed into avatar
| #[span.name(v-text="feed.displayName")] changed into avatar
template(v-if="feed.releaseStatus === 'public'")
| #[i.x-user-status.online]
template(v-else)
@@ -423,13 +423,13 @@ html
img(v-else-if="device[2] < 20" src="images/controller_status_ready_low.png" style="width:32px;height:32px")
img(v-else src="images/controller_status_ready.png" style="width:32px;height:32px")
br
span L:{{ device[2] }}%
span {{ $t('vr.status.devices.left') }}{{ device[2] }}%
template(v-else-if="device[0] === 'rightController'")
img(v-if="device[1] !== 'connected'" src="images/controller_status_off.png" style="width:32px;height:32px")
img(v-else-if="device[2] < 20" src="images/controller_status_ready_low.png" style="width:32px;height:32px")
img(v-else src="images/controller_status_ready.png" style="width:32px;height:32px")
br
span R:{{ device[2] }}%
span {{ $t('vr.status.devices.right') }}{{ device[2] }}%
template(v-else-if="device[0] === 'controller'")
img(v-if="device[1] !== 'connected'" src="images/controller_status_off.png" style="width:32px;height:32px")
img(v-else-if="device[2] < 20" src="images/controller_status_ready_low.png" style="width:32px;height:32px")
@@ -463,17 +463,17 @@ html
span(style="display:inline-block") {{ lastLocation.playerList.length }}
span(style="display:inline-block;font-weight:bold") {{ lastLocation.friendList.length !== 0 ? ` (${lastLocation.friendList.length})` : ''}}
template(v-else)
span(style="float:right") Timer: {{ lastLocationTimer }}
span(style="float:right") {{ $t('vr.status.timer') }} {{ lastLocationTimer }}
template(v-if="onlineForTimer")
|&nbsp;/ {{ onlineForTimer }}
template(v-if="pcUptime")
|&nbsp;/ {{ pcUptime }}
span(style="display:inline-block") Players: {{ lastLocation.playerList.length }}
span(style="display:inline-block") {{ $t('vr.status.players') }} {{ lastLocation.playerList.length }}
span(style="display:inline-block;font-weight:bold") {{ lastLocation.friendList.length !== 0 ? ` (${lastLocation.friendList.length})` : ''}}
br
span(style="float:right") {{ currentTime }}
span(v-if="config && !config.hideCpuUsageFromFeed" style="display:inline-block;margin-right:5px") CPU: {{ cpuUsage }}%
span(style="display:inline-block") Online: {{ onlineFriendCount }}
span(v-if="config && !config.hideCpuUsageFromFeed" style="display:inline-block;margin-right:5px") {{ $t('vr.status.cpu') }} {{ cpuUsage }}%
span(style="display:inline-block") {{ $t('vr.status.online') }} {{ onlineFriendCount }}
template(v-else)
svg(class="np-progress-circle")
circle(class="np-progress-circle-stroke" cx="60" cy="60" stroke="white" r="30" fill="transparent" stroke-width="60")