XFE Git
XFE Studio Git
Git 首页 全局搜索
XFE 主站 文档 NuGet

XFESpaceNinjaServer

A simple server for a small space ninja game

公开
关注 0 Fork 0 Star 0
返回提交历史

XFEstudio/XFESpaceNinjaServer

chore(webui): use translation system for titles (#3620)

Closes #3619 Reviewed-on: https://onlyg.it/OpenWF/SpaceNinjaServer/pulls/3620 Co-authored-by: Sainan <63328889+Sainan@users.noreply.github.com> Co-committed-by: Sainan <63328889+Sainan@users.noreply.github.com>

a1e37bcf
Sainan <63328889+Sainan@users.noreply.github.com>
提交于

代码差异

9 个文件 +27 -8
Modified static/webui/index.html +8 -8
@@ -79,7 +79,7 @@
79 79 </div>
80 80 </div>
81 81 <div id="main-content" class="w-100">
82 <div data-route="/webui/" data-title="Login | OpenWF WebUI">
82 <div data-route="/webui/" data-title-tag="login_title">
83 83 <p data-loc="login_description"></p>
84 84 <form onsubmit="doLogin();return false;">
85 85 <label for="email" data-loc="login_emailLabel"></label>
@@ -92,7 +92,7 @@
92 92 <button class="btn btn-secondary" type="submit" onclick="registerSubmit = true;" data-loc="login_registerButton"></button>
93 93 </form>
94 94 </div>
95 <div data-route="/webui/inventory" data-title="Inventory | OpenWF WebUI">
95 <div data-route="/webui/inventory" data-title-tag="navbar_inventory">
96 96 <p class="mb-3 inventory-update-note"></p>
97 97 <div class="card mb-3">
98 98 <div class="card-header">
@@ -553,7 +553,7 @@
553 553 </div>
554 554 </div>
555 555 </div>
556 <div id="guild-route" data-route="/webui/guildView" data-title="Guild | OpenWF WebUI">
556 <div id="guild-route" data-route="/webui/guildView" data-title-tag="navbar_guildView">
557 557 <h3 id="guildView-loading" data-loc="general_loading"></h3>
558 558 <h3 id="guildView-na" class="d-none" data-loc="guildView_na"></h3>
559 559 <h5 id="guildView-naDescription" class="d-none" data-loc="guildView_naDescription"></h5>
@@ -713,7 +713,7 @@
713 713 </div>
714 714 </div>
715 715 </div>
716 <div id="detailedView-route" data-route="/webui/detailedView" data-title="Inventory | OpenWF WebUI">
716 <div id="detailedView-route" data-route="/webui/detailedView" data-title-tag="navbar_inventory">
717 717 <h3 id="detailedView-loading" class="mb-0" data-loc="general_loading"></h3>
718 718 <h3 id="detailedView-title" class="mb-0"></h3>
719 719 <p class="text-body-secondary"></p>
@@ -828,7 +828,7 @@
828 828 <div id="equipmentFeaturesButtons-card" class="card-body d-flex flex-wrap gap-2"></div>
829 829 </div>
830 830 </div>
831 <div data-route="/webui/mods" data-title="Mods | OpenWF WebUI">
831 <div data-route="/webui/mods" data-title-tag="navbar_mods">
832 832 <p class="mb-3 inventory-update-note"></p>
833 833 <div class="row g-3">
834 834 <div class="col-xxl-6">
@@ -884,7 +884,7 @@
884 884 </div>
885 885 </div>
886 886 </div>
887 <div data-route="/webui/quests" data-title="Quests | OpenWF WebUI">
887 <div data-route="/webui/quests" data-title-tag="navbar_quests">
888 888 <p class="mb-3 inventory-update-note"></p>
889 889 <div class="row g-3">
890 890 <div class="col-md-6">
@@ -917,7 +917,7 @@
917 917 </div>
918 918 </div>
919 919 </div>
920 <div data-route="/webui/cheats, /webui/settings" data-title="Cheats | OpenWF WebUI">
920 <div data-route="/webui/cheats, /webui/settings" data-title-tag="navbar_cheats">
921 921 <div class="row g-3">
922 922 <div class="col-md-6">
923 923 <div class="card">
@@ -1626,7 +1626,7 @@
1626 1626 </div>
1627 1627 </div>
1628 1628 </div>
1629 <div data-route="/webui/import" data-title="Import | OpenWF WebUI">
1629 <div data-route="/webui/import" data-title-tag="navbar_import">
1630 1630 <p>
1631 1631 <span data-loc="import_importNote"></span>
1632 1632 <span data-loc="import_importNote2"></span>
Modified static/webui/script.js +12 -0
@@ -206,6 +206,13 @@ function deleteAccount() {
206 206 }
207 207 }
208 208
209 function updateTitle() {
210 const tag = single.getCurrentRoute().elm.getAttribute("data-title-tag");
211 if (tag) {
212 document.querySelector("title").textContent = loc(tag) + " | OpenWF WebUI";
213 }
214 }
215
209 216 single.on("route_load", function (event) {
210 217 if (event.route.paths[0] != "/webui/") {
211 218 // Authorised route?
@@ -223,6 +230,10 @@ single.on("route_load", function (event) {
223 230 if (navLink) {
224 231 navLink.classList.add("active");
225 232 }
233
234 window.dictPromise.then(() => {
235 updateTitle();
236 });
226 237 });
227 238
228 239 function loc(tag) {
@@ -280,6 +291,7 @@ function setActiveLanguage(lang) {
280 291 script.src = "/translations/" + webui_lang + ".js";
281 292 script.onload = function () {
282 293 updateLocElements();
294 updateTitle();
283 295 resolve(window.dict);
284 296 };
285 297 document.documentElement.appendChild(script);
Modified static/webui/translations/de.js +1 -0
@@ -106,6 +106,7 @@ dict = {
106 106 code_feature_64: `Zweiter Arkana Slot`,
107 107 code_feature_512: `Incarnon-Genesis`,
108 108 code_feature_1024: `Valenz-Überbrückung`,
109 login_title: `[UNTRANSLATED] Login`,
109 110 login_description: `Melde dich mit deinem OpenWF-Account an (denselben Angaben wie im Spiel, wenn du dich mit diesem Server verbindest).`,
110 111 login_emailLabel: `E-Mail-Adresse`,
111 112 login_passwordLabel: `Passwort`,
Modified static/webui/translations/en.js +1 -0
@@ -105,6 +105,7 @@ dict = {
105 105 code_feature_64: `Second Arcane Slot`,
106 106 code_feature_512: `Incarnon Genesis`,
107 107 code_feature_1024: `Valence Override`,
108 login_title: `Login`,
108 109 login_description: `Login using your OpenWF account credentials (same as in-game when connecting to this server).`,
109 110 login_emailLabel: `Email address`,
110 111 login_passwordLabel: `Password`,
Modified static/webui/translations/es.js +1 -0
@@ -106,6 +106,7 @@ dict = {
106 106 code_feature_64: `[UNTRANSLATED] Second Arcane Slot`,
107 107 code_feature_512: `Génesis Incarnon`,
108 108 code_feature_1024: `Anulación de valencia`,
109 login_title: `[UNTRANSLATED] Login`,
109 110 login_description: `Inicia sesión con las credenciales de tu cuenta OpenWF (las mismas que usas en el juego al conectarte a este servidor).`,
110 111 login_emailLabel: `Dirección de correo electrónico`,
111 112 login_passwordLabel: `Contraseña`,
Modified static/webui/translations/fr.js +1 -0
@@ -106,6 +106,7 @@ dict = {
106 106 code_feature_64: `Emplacement d'Arcane pour les Armes Secondaire`,
107 107 code_feature_512: `Genesis Incarnon`,
108 108 code_feature_1024: `Fusion de Valence`,
109 login_title: `[UNTRANSLATED] Login`,
109 110 login_description: `Connexion avec les informations de connexion OpenWF.`,
110 111 login_emailLabel: `Email`,
111 112 login_passwordLabel: `Mot de passe`,
Modified static/webui/translations/ru.js +1 -0
@@ -106,6 +106,7 @@ dict = {
106 106 code_feature_64: `Второй слот Мистификатора`,
107 107 code_feature_512: `Генезис Инкарнона`,
108 108 code_feature_1024: `Переопределение валентности`,
109 login_title: `[UNTRANSLATED] Login`,
109 110 login_description: `Войдите, используя учетные данные OpenWF (те же, что и в игре при подключении к этому серверу).`,
110 111 login_emailLabel: `Адрес электронной почты`,
111 112 login_passwordLabel: `Пароль`,
Modified static/webui/translations/uk.js +1 -0
@@ -106,6 +106,7 @@ dict = {
106 106 code_feature_64: `Друга комірка містифікатора`,
107 107 code_feature_512: `Інкарнонський генезис`,
108 108 code_feature_1024: `Валентна перевага`,
109 login_title: `[UNTRANSLATED] Login`,
109 110 login_description: `Увійдіть, використовуючи облікові дані OpenWF (ті ж, що й у грі при підключенні до цього серверу).`,
110 111 login_emailLabel: `Адреса електронної пошти`,
111 112 login_passwordLabel: `Пароль`,
Modified static/webui/translations/zh.js +1 -0
@@ -106,6 +106,7 @@ dict = {
106 106 code_feature_64: `次要赋能槽位`,
107 107 code_feature_512: `灵化之源`,
108 108 code_feature_1024: `效价覆写`,
109 login_title: `[UNTRANSLATED] Login`,
109 110 login_description: `使用您的 OpenWF 账户凭证登录(与游戏内连接本服务器时使用的昵称相同)`,
110 111 login_emailLabel: `电子邮箱`,
111 112 login_passwordLabel: `密码`,