使能中文翻译

This commit is contained in:
chishin 2022-05-16 13:42:23 +08:00
parent 4ce44527c4
commit 2195b853b3
4 changed files with 8 additions and 7 deletions

View File

@ -1,10 +1,10 @@
<!doctype html>
<html lang="en" dir="ltr">
<html lang="zh" dir="ltr">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<meta http-equiv="Content-Language" content="en">
<meta http-equiv="Content-Language" content="zh">
<meta name="apple-mobile-web-app-status-bar-style" content="black-translucent">
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="mobile-web-app-capable" content="yes">
@ -27,7 +27,7 @@
<noscript>
<div class="container no-js-warning">
<div class="alert alert-warning text-center">
<strong>Warning!</strong> This application requires Javascript and your browser doesn't support it.
<strong>警告!</strong> 此应用程序需要Javascript而您的浏览器不支持它。
</div>
</div>
</noscript>

View File

@ -2,7 +2,7 @@ const UserModel = require('../models/user');
let cache = {
User: new UserModel.Model(),
locale: 'en',
locale: 'zh',
version: null
};

View File

@ -10,13 +10,13 @@ module.exports = function (namespace, key, data) {
let locale = Cache.locale;
// check that the locale exists
if (typeof messages[locale] === 'undefined') {
locale = 'en';
locale = 'zh';
}
if (typeof messages[locale][namespace] !== 'undefined' && typeof messages[locale][namespace][key] !== 'undefined') {
return messages[locale][namespace][key](data);
} else if (locale !== 'en' && typeof messages['en'][namespace] !== 'undefined' && typeof messages['en'][namespace][key] !== 'undefined') {
return messages['en'][namespace][key](data);
} else if (locale !== 'zh' && typeof messages['zh'][namespace] !== 'undefined' && typeof messages['zh'][namespace][key] !== 'undefined') {
return messages['zh'][namespace][key](data);
}
return '(MISSING: ' + namespace + '/' + key + ')';

View File

@ -12,5 +12,6 @@
<%- i18n('main', 'version', {version: getVersion()}) %>
<%= i18n('footer', 'copy', {url: 'https://jc21.com?utm_source=nginx-proxy-manager'}) %>
<%= i18n('footer', 'theme', {url: 'https://tabler.github.io/?utm_source=nginx-proxy-manager'}) %>
<%= i18n('footer', 'translate', {url: 'https://github.com/xiaoxinpro/nginx-proxy-manager-zh'}) %>
</div>
</div>