mirror of
https://github.com/mofeng-git/One-KVM.git
synced 2025-12-12 01:00:29 +08:00
进一步的网页国际化支持
This commit is contained in:
parent
4a6fbce485
commit
0af0e2b4d0
@ -51,14 +51,15 @@ html(lang="en")
|
||||
link(rel="stylesheet" href=`${css_dir}/${name}.css`)
|
||||
link(rel="stylesheet" href=`${css_dir}/user.css`)
|
||||
|
||||
script(src=`${js_dir}/i18n/jquery-3.7.1.min.js`)
|
||||
script(src=`${js_dir}/i18n/jquery.i18n.min.js`)
|
||||
script(src=`${js_dir}/i18n/i18n.js`)
|
||||
|
||||
if main_js
|
||||
script(type="module")
|
||||
| import {main} from "#{js_dir}/#{main_js}.js";
|
||||
| main();
|
||||
|
||||
script(src=`${js_dir}/i18n/jquery-3.7.1.min.js`)
|
||||
script(src=`${js_dir}/i18n/jquery.i18n.min.js`)
|
||||
script(src=`${js_dir}/i18n/i18n.js`)
|
||||
|
||||
body(class=body_class)
|
||||
block body
|
||||
|
||||
@ -40,12 +40,12 @@
|
||||
<link rel="stylesheet" href="/share/css/modal.css">
|
||||
<link rel="stylesheet" href="/share/css/index/index.css">
|
||||
<link rel="stylesheet" href="/share/css/user.css">
|
||||
<script type="module">import {main} from "/share/js/index/main.js";
|
||||
main();
|
||||
</script>
|
||||
<script src="/share/js/i18n/jquery-3.7.1.min.js"></script>
|
||||
<script src="/share/js/i18n/jquery.i18n.min.js"></script>
|
||||
<script src="/share/js/i18n/i18n.js"></script>
|
||||
<script type="module">import {main} from "/share/js/index/main.js";
|
||||
main();
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<div class="start-box">
|
||||
@ -56,39 +56,37 @@
|
||||
<td>
|
||||
<table>
|
||||
<tr>
|
||||
<td class="title" colspan="2">The Open Source KVM over IP</td>
|
||||
<td class="title" colspan="2" i18n="index_title">The Open Source KVM over IP</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="copyright" colspan="2">Copyright © 2018-2024 <a target="_blank" href="mailto:mdevaev@gmail.com">Maxim Devaev</a></td>
|
||||
<td class="copyright" colspan="2" i18n="copyright">Copyright © 2018-2024 Maxim Devaev | Modified by SilentWind</td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<hr>
|
||||
<table>
|
||||
<td class="server">
|
||||
<td>Server:</td>
|
||||
<td><a id="kvmd-meta-server-host" target="_blank" href="/api/info"></a></td>
|
||||
</td>
|
||||
</table>
|
||||
<hr>
|
||||
<div id="apps-box">
|
||||
<h4>Loading ...</h4>
|
||||
</div>
|
||||
<div id="app-keyboard-warning">
|
||||
<hr>
|
||||
<p class="text">
|
||||
<table>
|
||||
<td class="server">
|
||||
<td i18n="serve_name">Server:</td>
|
||||
<td><a id="kvmd-meta-server-host" target="_blank" href="/api/info"></a></td>
|
||||
</td>
|
||||
</table>
|
||||
<div id="app-keyboard-warning">
|
||||
<p class="text" i18n="index_text_1">
|
||||
Please note that when you are working with a KVM session or another application that captures the keyboard,
|
||||
you can't use some keyboard shortcuts such as Ctrl+Alt+Del (which will be caught by your OS) or Ctrl+W (caught by your browser).
|
||||
</p>
|
||||
<p class="text">To override this limitation you can use <a target="_blank" href="https://google.com/chrome">Google Chrome</a>
|
||||
<p class="text" i18n="index_text_2">To override this limitation you can use <a target="_blank" href="https://google.com/chrome">Google Chrome</a>
|
||||
or <a target="_blank" href="https://chromium.org/Home">Chromium</a> in application mode.
|
||||
</p>
|
||||
<div class="code" id="app-text"></div>
|
||||
</div>
|
||||
<hr>
|
||||
<p class="text credits"><a target="_blank" href="https://pikvm.org">PiKVM Project</a> | <a target="_blank" href="https://docs.pikvm.org">Documentation</a> | <a target="_blank" href="https://pikvm.org/support">Support</a></p>
|
||||
<p class="text credits"><a target="_blank" href="https://pikvm.org" i18n="index_text_10">PiKVM Project</a> | <a target="_blank" href="https://docs.pikvm.org" i18n="index_text_11">PiKVM Documentation</a> | <a target="_blank" href="https://github.com/mofeng-git/One-KVM" i18n="index_text_12">One-KVM Project</a> | <a target="_blank" href="https://one-kvm.mofeng.run" i18n="index_text_13">One-KVM Documentation</a></p>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
|
||||
@ -13,35 +13,36 @@ block start
|
||||
img(class="svg-gray" src=`${svg_dir}/logo.svg` alt="PiKVM" height="40")
|
||||
td
|
||||
table
|
||||
tr #[td(colspan="2" class="title") The Open Source KVM over IP]
|
||||
tr #[td(colspan="2" class="title" i18n="index_title") The Open Source KVM over IP]
|
||||
tr
|
||||
td(colspan="2" class="copyright")
|
||||
| Copyright © 2018-2024 #[a(target="_blank" href="mailto:mdevaev@gmail.com") Maxim Devaev]
|
||||
td(colspan="2" class="copyright" i18n="copyright")
|
||||
| Copyright © 2018-2024 Maxim Devaev | Modified by SilentWind
|
||||
|
||||
hr
|
||||
|
||||
div(id="apps-box")
|
||||
h4 Loading ...
|
||||
|
||||
hr
|
||||
table
|
||||
td(class="server")
|
||||
td Server:
|
||||
td(i18n="serve_name") Server:
|
||||
td #[a(id="kvmd-meta-server-host" target="_blank" href="/api/info")]
|
||||
|
||||
hr
|
||||
div(id="apps-box")
|
||||
h4 Loading ...
|
||||
|
||||
div(id="app-keyboard-warning")
|
||||
hr
|
||||
p(class="text")
|
||||
p(class="text" i18n="index_text_1")
|
||||
| Please note that when you are working with a KVM session or another application that captures the keyboard,
|
||||
| you can't use some keyboard shortcuts such as Ctrl+Alt+Del (which will be caught by your OS) or Ctrl+W (caught by your browser).
|
||||
p(class="text")
|
||||
p(class="text" i18n="index_text_2")
|
||||
| To override this limitation you can use #[a(target="_blank" href="https://google.com/chrome") Google Chrome]
|
||||
| or #[a(target="_blank" href="https://chromium.org/Home") Chromium] in application mode.
|
||||
div(id="app-text" class="code")
|
||||
|
||||
hr
|
||||
p(class="text credits")
|
||||
a(target="_blank" href="https://pikvm.org") PiKVM Project
|
||||
a(target="_blank" href="https://pikvm.org" i18n="index_text_10") PiKVM Project
|
||||
| |
|
||||
a(target="_blank" href="https://docs.pikvm.org") Documentation
|
||||
a(target="_blank" href="https://docs.pikvm.org" i18n="index_text_11") PiKVM Documentation
|
||||
| |
|
||||
a(target="_blank" href="https://pikvm.org/support") Support
|
||||
a(target="_blank" href="https://github.com/mofeng-git/One-KVM" i18n="index_text_12") One-KVM Project
|
||||
| |
|
||||
a(target="_blank" href="https://one-kvm.mofeng.run" i18n="index_text_13") One-KVM Documentation
|
||||
@ -37,16 +37,16 @@
|
||||
<link rel="stylesheet" href="/share/css/main.css">
|
||||
<link rel="stylesheet" href="/share/css/start.css">
|
||||
<link rel="stylesheet" href="/share/css/user.css">
|
||||
<script type="module">import {main} from "/share/js/ipmi/main.js";
|
||||
main();
|
||||
</script>
|
||||
<script src="/share/js/i18n/jquery-3.7.1.min.js"></script>
|
||||
<script src="/share/js/i18n/jquery.i18n.min.js"></script>
|
||||
<script src="/share/js/i18n/i18n.js"></script>
|
||||
<script type="module">import {main} from "/share/js/ipmi/main.js";
|
||||
main();
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<div class="start-box">
|
||||
<div class="start"><a style="display:inline-block; margin-top:4px; color:#5c90bc; text-decoration:none" href="/"> ← [ PiKVM Index ]</a>
|
||||
<div class="start"><a style="display:inline-block; margin-top:4px; color:#5c90bc; text-decoration:none" href="/" i18n="index"> ← [ One-KVM Index ]</a>
|
||||
<hr>
|
||||
<p class="text">This PiKVM device has running <b>kvmd-ipmi</b> daemon and provides IPMI 2.0 interface for some basic
|
||||
BMC operations like on/off/reset the server.
|
||||
|
||||
@ -52,12 +52,12 @@
|
||||
<link rel="stylesheet" href="/share/css/kvm/keyboard.css">
|
||||
<link rel="stylesheet" href="/share/css/kvm/about.css">
|
||||
<link rel="stylesheet" href="/share/css/user.css">
|
||||
<script type="module">import {main} from "/share/js/kvm/main.js";
|
||||
main();
|
||||
</script>
|
||||
<script src="/share/js/i18n/jquery-3.7.1.min.js"></script>
|
||||
<script src="/share/js/i18n/jquery.i18n.min.js"></script>
|
||||
<script src="/share/js/i18n/i18n.js"></script>
|
||||
<script type="module">import {main} from "/share/js/kvm/main.js";
|
||||
main();
|
||||
</script>
|
||||
</head>
|
||||
<body class="body-no-select">
|
||||
<ul id="navbar">
|
||||
|
||||
@ -39,12 +39,12 @@
|
||||
<link rel="stylesheet" href="/share/css/modal.css">
|
||||
<link rel="stylesheet" href="/share/css/login/login.css">
|
||||
<link rel="stylesheet" href="/share/css/user.css">
|
||||
<script type="module">import {main} from "/share/js/login/main.js";
|
||||
main();
|
||||
</script>
|
||||
<script src="/share/js/i18n/jquery-3.7.1.min.js"></script>
|
||||
<script src="/share/js/i18n/jquery.i18n.min.js"></script>
|
||||
<script src="/share/js/i18n/i18n.js"></script>
|
||||
<script type="module">import {main} from "/share/js/login/main.js";
|
||||
main();
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<form action="javascript:void(0)">
|
||||
@ -78,8 +78,8 @@
|
||||
<td i18n="select_language">Select language: </td>
|
||||
<td>
|
||||
<select id="selectLanguage">
|
||||
<option class="english" value="en" i18n="english">英语 </option>
|
||||
<option class="chinese" value="ch" selected="selected" i18n="chinese">简体中文</option>
|
||||
<option class="chinese" value="ch" selected="selected" i18n="chinese">Simplified Chinese</option>
|
||||
<option class="english" value="en" i18n="english">English</option>
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
@ -94,7 +94,7 @@
|
||||
</div>
|
||||
</form>
|
||||
<ul class="footer">
|
||||
<li class="footer-left">This site is actively using JavaScript.<br>
|
||||
<li class="footer-left" i18n="footer-left">This site is actively using JavaScript.<br>
|
||||
It doesn't contain ads, but is blocked by some ad filters.<br>
|
||||
Please turn it off to continue and reload the page.
|
||||
</li>
|
||||
|
||||
@ -26,14 +26,14 @@ block body
|
||||
td(i18n="select_language") Select language:
|
||||
td
|
||||
select(id="selectLanguage")
|
||||
option(value='en' class="english" i18n="english") 英语
|
||||
option(value='ch', selected="selected" class="chinese" i18n="chinese") 简体中文
|
||||
option(value='ch', selected="selected" class="chinese" i18n="chinese") Simplified Chinese
|
||||
option(value='en' class="english" i18n="english") English
|
||||
tr
|
||||
td
|
||||
td #[button(id="login-button" class="key" i18n="login") Login]
|
||||
|
||||
ul(class="footer")
|
||||
li(class="footer-left")
|
||||
li(class="footer-left" i18n="footer-left")
|
||||
| This site is actively using JavaScript.#[br]
|
||||
| It doesn't contain ads, but is blocked by some ad filters.#[br]
|
||||
| Please turn it off to continue and reload the page.
|
||||
|
||||
@ -1,10 +1,21 @@
|
||||
{
|
||||
"username": "用户名: ",
|
||||
"password": "密码: ",
|
||||
"2fa_code": "2FA 验证码: ",
|
||||
"2fa_code": "2FA 验证: ",
|
||||
"if_enabled": "如果有",
|
||||
"login": "登录",
|
||||
"select_language": "选择语言: ",
|
||||
"chinese": "简体中文",
|
||||
"english": "英语"
|
||||
"english": "英语",
|
||||
"footer-left": "本网站需要使用 JavaScript 功能。<br>本网站不含广告,但仍有可能会被某些广告过滤器屏蔽。<br>如果网页响应异常请关闭它并重新加载页面以继续浏览。",
|
||||
"index": " One-KVM 导航 ",
|
||||
"copyright": "版权所有 © 2018-2024 Maxim Devaev | 由 SilentWind 二次开发",
|
||||
"index_text_1": "请注意,在使用 KVM 会话或其他可捕获键盘的应用程序时,您无法使用某些快捷键,如 Ctrl+Alt+Del(这会被操作系统捕获)或 Ctrl+W(这会被浏览器捕获)。",
|
||||
"index_text_2": "要突破这一限制,您可以在应用程序模式下使用 Google Chrome 浏览器。",
|
||||
"serve_name": "主机名:",
|
||||
"index_text_10":"PiKVM 项目",
|
||||
"index_text_11":"PiKVM 文档",
|
||||
"index_text_12":"One-KVM 项目",
|
||||
"index_text_13":"One-KVM 文档",
|
||||
"index_title":"开源 KVM over IP"
|
||||
}
|
||||
@ -6,5 +6,16 @@
|
||||
"login": "Login",
|
||||
"select_language": "Select language: ",
|
||||
"chinese": "Simplified Chinese",
|
||||
"english": "English"
|
||||
"english": "English",
|
||||
"footer-left": "This site is actively using JavaScript.<br>It doesn't contain ads, but is blocked by some ad filters.<br>Please turn it off to continue and reload the page.",
|
||||
"index": " One-KVM Index ",
|
||||
"copyright": "Copyright © 2018-2024 Maxim Devaev | Modified by SilentWind",
|
||||
"index_text_1": "Please note that when you are working with a KVM session or another application that captures the keyboard,you can't use some keyboard shortcuts such as Ctrl+Alt+Del (which will be caught by your OS) or Ctrl+W (caught by your browser).",
|
||||
"index_text_2": "To override this limitation you can use Google Chrome in application mode.",
|
||||
"serve_name": "Server:",
|
||||
"index_text_10":"PiKVM Project",
|
||||
"index_text_11":"PiKVM Documentation",
|
||||
"index_text_12":"One-KVM Project",
|
||||
"index_text_13":"One-KVM Documentation",
|
||||
"index_title":"The Open Source KVM over IP"
|
||||
}
|
||||
@ -1,14 +1,50 @@
|
||||
/* cookie存储用户选取的值 */
|
||||
function setCookie (name, value)
|
||||
{
|
||||
/* 设置名称为name,值为value的Cookie */
|
||||
var expdate = new Date();
|
||||
/* 计算时间,30天后过期 */
|
||||
expdate.setTime(expdate.getTime() + 30 * 24 * 60 * 60 * 1000);
|
||||
document.cookie = name + "=" + value + "; expires=" + expdate.toGMTString() + "; path=/" + ";SameSite=Lax";
|
||||
/* 即document.cookie= name+"="+value+";path=/"; 时间可以不要,但路径(path)必须要填写,因为JS的默认路径是当前页,如果不填,此cookie只在当前页面生效! */
|
||||
}
|
||||
|
||||
/* 获取cookie */
|
||||
function getCookie(name)
|
||||
{
|
||||
if (document.cookie.length > 0)
|
||||
{
|
||||
start = document.cookie.indexOf(name + "=")
|
||||
if (start != -1)
|
||||
{
|
||||
start = start + name.length + 1
|
||||
end = document.cookie.indexOf(";", start)
|
||||
if (end == -1) end = document.cookie.length
|
||||
return unescape(document.cookie.substring(start, end))
|
||||
}
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置语言类型: 默认为中文
|
||||
*/
|
||||
var i18nLanguage = "cn";
|
||||
|
||||
$(document).ready(function() {
|
||||
/*默认语言*/
|
||||
var defaultLang = "cn";
|
||||
/* 首先获取用户选择过的语言 */
|
||||
if (getCookie('userLanguage')) {
|
||||
i18nLanguage = getCookie('userLanguage');
|
||||
}
|
||||
|
||||
$("[i18n]").i18n({
|
||||
defaultLang: defaultLang,
|
||||
defaultLang: i18nLanguage,
|
||||
filePath: "/share/i18n/",
|
||||
filePrefix: "i18n_",
|
||||
fileSuffix: "",
|
||||
forever: true,
|
||||
callback: function() {
|
||||
console.log("i18n is ready.");
|
||||
|
||||
}
|
||||
});
|
||||
/*切换为中文 - 按钮*/
|
||||
@ -17,6 +53,7 @@ $(document).ready(function() {
|
||||
defaultLang: "cn",
|
||||
filePath: "/share/i18n/"
|
||||
});
|
||||
setCookie('userLanguage', "cn")
|
||||
});
|
||||
/*切换为英文 - 按钮*/
|
||||
$(".english").click(function() {
|
||||
@ -24,6 +61,7 @@ $(document).ready(function() {
|
||||
defaultLang: "en",
|
||||
filePath: "/share/i18n/"
|
||||
});
|
||||
setCookie('userLanguage', "en")
|
||||
});
|
||||
|
||||
});
|
||||
@ -32,23 +32,10 @@ export function main() {
|
||||
initWindowManager();
|
||||
|
||||
if (checkBrowser(null, null)) {
|
||||
__setAppText();
|
||||
__loadKvmdInfo();
|
||||
}
|
||||
}
|
||||
|
||||
function __setAppText() {
|
||||
$("app-text").innerHTML = `
|
||||
<span class="code-comment"># On Linux using Chromium/Chrome via any terminal:<br>
|
||||
$</span> \`which chromium 2>/dev/null || which chrome 2>/dev/null || which google-chrome\` --app="${window.location.href}"<br>
|
||||
<br>
|
||||
<span class="code-comment"># On MacOS using Terminal application:<br>
|
||||
$</span> /Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome --app="${window.location.href}"<br>
|
||||
<br>
|
||||
<span class="code-comment"># On Windows via cmd.exe:<br>
|
||||
C:\></span> start chrome --app="${window.location.href}"
|
||||
`;
|
||||
}
|
||||
|
||||
function __loadKvmdInfo() {
|
||||
tools.httpGet("/api/info?fields=auth,meta,extras", function(http) {
|
||||
|
||||
@ -8,7 +8,7 @@ block body
|
||||
div(class="start-box")
|
||||
div(class="start")
|
||||
if index_link
|
||||
a(style="display:inline-block; margin-top:4px; color:#5c90bc; text-decoration:none" href="/")
|
||||
| ← [ PiKVM Index ]
|
||||
a(style="display:inline-block; margin-top:4px; color:#5c90bc; text-decoration:none" href="/" i18n="index")
|
||||
| ← [ One-KVM Index ]
|
||||
hr
|
||||
block start
|
||||
|
||||
@ -37,16 +37,16 @@
|
||||
<link rel="stylesheet" href="/share/css/main.css">
|
||||
<link rel="stylesheet" href="/share/css/start.css">
|
||||
<link rel="stylesheet" href="/share/css/user.css">
|
||||
<script type="module">import {main} from "/share/js/vnc/main.js";
|
||||
main();
|
||||
</script>
|
||||
<script src="/share/js/i18n/jquery-3.7.1.min.js"></script>
|
||||
<script src="/share/js/i18n/jquery.i18n.min.js"></script>
|
||||
<script src="/share/js/i18n/i18n.js"></script>
|
||||
<script type="module">import {main} from "/share/js/vnc/main.js";
|
||||
main();
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<div class="start-box">
|
||||
<div class="start"><a style="display:inline-block; margin-top:4px; color:#5c90bc; text-decoration:none" href="/"> ← [ PiKVM Index ]</a>
|
||||
<div class="start"><a style="display:inline-block; margin-top:4px; color:#5c90bc; text-decoration:none" href="/" i18n="index"> ← [ One-KVM Index ]</a>
|
||||
<hr>
|
||||
<p class="text">This PiKVM device has running <b>kvmd-vnc</b> daemon and provides VNC access to the server.</p>
|
||||
<p class="text"><b>WARNING!</b> We strongly don't recommend you to use VNC in untrusted networks without
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user