国际化

This commit is contained in:
xuxueli 2018-01-19 17:49:42 +08:00
parent 25c680a6bf
commit 84f093ab42
15 changed files with 125 additions and 97 deletions

View File

@ -1,5 +1,6 @@
package com.xxl.job.admin.core.util; package com.xxl.job.admin.core.util;
import com.xxl.job.core.util.JacksonUtil;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.core.io.ClassPathResource; import org.springframework.core.io.ClassPathResource;
@ -8,6 +9,8 @@ import org.springframework.core.io.support.EncodedResource;
import org.springframework.core.io.support.PropertiesLoaderUtils; import org.springframework.core.io.support.PropertiesLoaderUtils;
import java.io.IOException; import java.io.IOException;
import java.util.HashMap;
import java.util.Map;
import java.util.Properties; import java.util.Properties;
/** /**
@ -19,14 +22,12 @@ public class I18nUtil {
private static Logger logger = LoggerFactory.getLogger(I18nUtil.class); private static Logger logger = LoggerFactory.getLogger(I18nUtil.class);
private static final String i18n_file = "i18n/message.properties"; private static final String i18n_file = "i18n/message.properties";
private static Properties prop = null; private static Properties prop = null;
private static boolean prop_cache = false;
public static Properties loadI18nProp(){ public static Properties loadI18nProp(){
if (prop_cache && prop != null) { if (prop != null) {
return prop; //return prop;
} }
try { try {
Resource resource = new ClassPathResource(i18n_file); Resource resource = new ClassPathResource(i18n_file);
EncodedResource encodedResource = new EncodedResource(resource,"UTF-8"); EncodedResource encodedResource = new EncodedResource(resource,"UTF-8");
@ -37,8 +38,38 @@ public class I18nUtil {
return prop; return prop;
} }
/**
* get val of i18n key
*
* @param key
* @return
*/
public static String getString(String key) { public static String getString(String key) {
return loadI18nProp().getProperty(key); return loadI18nProp().getProperty(key);
} }
/**
* get mult val of i18n mult key, as json
*
* @param keys
* @return
*/
public static String getMultString(String... keys) {
Map<String, String> map = new HashMap<>();
Properties prop = loadI18nProp();
if (keys!=null && keys.length>0) {
for (String key: keys) {
map.put(key, prop.getProperty(key));
}
} else {
for (String key: prop.stringPropertyNames()) {
map.put(key, prop.getProperty(key));
}
}
String json = JacksonUtil.writeValueAsString(map);
return json;
}
} }

View File

@ -1,5 +1,6 @@
admin_name=任务调度中心 admin_name=任务调度中心
admin_name_full=分布式任务调度平台XXL-JOB admin_name_full=分布式任务调度平台XXL-JOB
admin_version=1.9.1(快照版本)
## system ## system
system_tips=系统提示 system_tips=系统提示

View File

@ -29,6 +29,10 @@
<!-- pace --> <!-- pace -->
<link rel="stylesheet" href="${request.contextPath}/static/plugins/pace/themes/pace-theme-flash.css"> <link rel="stylesheet" href="${request.contextPath}/static/plugins/pace/themes/pace-theme-flash.css">
<#-- i18n -->
<#global I18n = I18nUtil.getMultString()?eval />
</#macro> </#macro>
<#macro commonScript> <#macro commonScript>
@ -55,14 +59,7 @@
<script src="${request.contextPath}/static/js/common.1.js"></script> <script src="${request.contextPath}/static/js/common.1.js"></script>
<script> <script>
var base_url = '${request.contextPath}'; var base_url = '${request.contextPath}';
var I18n = ${I18nUtil.getMultString()};
var system_tips = '${I18nUtil.getString("system_tips")}';
var system_ok = '${I18nUtil.getString("system_ok")}';
var system_close = '${I18nUtil.getString("system_close")}';
var logout_confirm = '${I18nUtil.getString("logout_confirm")}';
var logout_success = '${I18nUtil.getString("logout_success")}';
var logout_fail = '${I18nUtil.getString("logout_fail")}';
</script> </script>
</#macro> </#macro>
@ -71,7 +68,7 @@
<header class="main-header"> <header class="main-header">
<a href="${request.contextPath}/" class="logo"> <a href="${request.contextPath}/" class="logo">
<span class="logo-mini"><b>XXL</b></span> <span class="logo-mini"><b>XXL</b></span>
<span class="logo-lg"><b>${I18nUtil.getString("admin_name")}</b></span> <span class="logo-lg"><b>${I18n.admin_name}</b></span>
</a> </a>
<nav class="navbar navbar-static-top" role="navigation"> <nav class="navbar navbar-static-top" role="navigation">
<a href="#" class="sidebar-toggle" data-toggle="offcanvas" role="button"><span class="sr-only">切换导航</span></a> <a href="#" class="sidebar-toggle" data-toggle="offcanvas" role="button"><span class="sr-only">切换导航</span></a>
@ -79,7 +76,7 @@
<ul class="nav navbar-nav"> <ul class="nav navbar-nav">
<li class="dropdown user user-menu"> <li class="dropdown user user-menu">
<a href=";" id="logoutBtn" class="dropdown-toggle" data-toggle="dropdown" aria-expanded="false"> <a href=";" id="logoutBtn" class="dropdown-toggle" data-toggle="dropdown" aria-expanded="false">
<span class="hidden-xs">${I18nUtil.getString("logout_btn")}</span> <span class="hidden-xs">${I18n.logout_btn}</span>
</a> </a>
</li> </li>
</ul> </ul>
@ -95,11 +92,11 @@
<section class="sidebar"> <section class="sidebar">
<!-- sidebar menu: : style can be found in sidebar.less --> <!-- sidebar menu: : style can be found in sidebar.less -->
<ul class="sidebar-menu"> <ul class="sidebar-menu">
<#--<li class="header">常用模块</li>--> <li class="header">导航</li>
<li class="nav-click <#if pageName == "jobinfo">active</#if>" ><a href="${request.contextPath}/jobinfo"><i class="fa fa-circle-o text-aqua"></i><span>${I18nUtil.getString("jobinfo_name")}</span></a></li> <li class="nav-click <#if pageName == "jobinfo">active</#if>" ><a href="${request.contextPath}/jobinfo"><i class="fa fa-circle-o text-aqua"></i><span>${I18n.jobinfo_name}</span></a></li>
<li class="nav-click <#if pageName == "joblog">active</#if>" ><a href="${request.contextPath}/joblog"><i class="fa fa-circle-o text-yellow"></i><span>${I18nUtil.getString("joblog_name")}</span></a></li> <li class="nav-click <#if pageName == "joblog">active</#if>" ><a href="${request.contextPath}/joblog"><i class="fa fa-circle-o text-yellow"></i><span>${I18n.joblog_name}</span></a></li>
<li class="nav-click <#if pageName == "jobgroup">active</#if>" ><a href="${request.contextPath}/jobgroup"><i class="fa fa-circle-o text-green"></i><span>${I18nUtil.getString("jobgroup_name")}</span></a></li> <li class="nav-click <#if pageName == "jobgroup">active</#if>" ><a href="${request.contextPath}/jobgroup"><i class="fa fa-circle-o text-green"></i><span>${I18n.jobgroup_name}</span></a></li>
<li class="nav-click <#if pageName == "help">active</#if>" ><a href="${request.contextPath}/help"><i class="fa fa-circle-o text-gray"></i><span>${I18nUtil.getString("job_help")}</span></a></li> <li class="nav-click <#if pageName == "help">active</#if>" ><a href="${request.contextPath}/help"><i class="fa fa-circle-o text-gray"></i><span>${I18n.job_help}</span></a></li>
</ul> </ul>
</section> </section>
<!-- /.sidebar --> <!-- /.sidebar -->
@ -185,7 +182,7 @@
<#macro commonFooter > <#macro commonFooter >
<footer class="main-footer"> <footer class="main-footer">
Powered by <b>XXL-JOB</b> 1.9.1SNAPSHOT Powered by <b>XXL-JOB</b> ${I18n.admin_version}
<div class="pull-right hidden-xs"> <div class="pull-right hidden-xs">
<strong>Copyright &copy; 2015-${.now?string('yyyy')} &nbsp; <strong>Copyright &copy; 2015-${.now?string('yyyy')} &nbsp;
<a href="http://www.xuxueli.com/" target="_blank" >xuxueli</a> <a href="http://www.xuxueli.com/" target="_blank" >xuxueli</a>

View File

@ -1,9 +1,9 @@
<!DOCTYPE html> <!DOCTYPE html>
<html> <html>
<head> <head>
<title>${I18nUtil.getString("admin_name")}</title>
<#import "/common/common.macro.ftl" as netCommon> <#import "/common/common.macro.ftl" as netCommon>
<@netCommon.commonStyle /> <@netCommon.commonStyle />
<title>${I18n.admin_name}</title>
</head> </head>
<body class="hold-transition skin-blue sidebar-mini <#if cookieMap?exists && "off" == cookieMap["xxljob_adminlte_settings"].value >sidebar-collapse</#if> "> <body class="hold-transition skin-blue sidebar-mini <#if cookieMap?exists && "off" == cookieMap["xxljob_adminlte_settings"].value >sidebar-collapse</#if> ">
<div class="wrapper"> <div class="wrapper">
@ -16,25 +16,19 @@
<div class="content-wrapper"> <div class="content-wrapper">
<!-- Content Header (Page header) --> <!-- Content Header (Page header) -->
<section class="content-header"> <section class="content-header">
<h1>${I18nUtil.getString("job_help")}</h1> <h1>${I18n.job_help}</h1>
<!--
<ol class="breadcrumb">
<li><a><i class="fa fa-dashboard"></i>调度中心</a></li>
<li class="active">使用教程</li>
</ol>
-->
</section> </section>
<!-- Main content --> <!-- Main content -->
<section class="content"> <section class="content">
<div class="callout callout-info"> <div class="callout callout-info">
<h4>${I18nUtil.getString("admin_name_full")}</h4> <h4>${I18n.admin_name_full}</h4>
<br> <br>
<p> <p>
<a target="_blank" href="https://github.com/xuxueli/xxl-job">github</a>&nbsp;&nbsp;&nbsp;&nbsp; <a target="_blank" href="https://github.com/xuxueli/xxl-job">github</a>&nbsp;&nbsp;&nbsp;&nbsp;
<iframe src="https://ghbtns.com/github-btn.html?user=xuxueli&repo=xxl-job&type=star&count=true" frameborder="0" scrolling="0" width="170px" height="20px" style="margin-bottom:-5px;"></iframe> <iframe src="https://ghbtns.com/github-btn.html?user=xuxueli&repo=xxl-job&type=star&count=true" frameborder="0" scrolling="0" width="170px" height="20px" style="margin-bottom:-5px;"></iframe>
<br><br> <br><br>
<a target="_blank" href="http://www.xuxueli.com/xxl-job/">${I18nUtil.getString("job_help_document")}</a> <a target="_blank" href="http://www.xuxueli.com/xxl-job/">${I18n.job_help_document}</a>
<br><br> <br><br>
</p> </p>

View File

@ -1,11 +1,11 @@
<!DOCTYPE html> <!DOCTYPE html>
<html> <html>
<head> <head>
<title>${I18nUtil.getString("admin_name")}</title>
<#import "/common/common.macro.ftl" as netCommon> <#import "/common/common.macro.ftl" as netCommon>
<@netCommon.commonStyle /> <@netCommon.commonStyle />
<!-- daterangepicker --> <!-- daterangepicker -->
<link rel="stylesheet" href="${request.contextPath}/static/adminlte/plugins/daterangepicker/daterangepicker.css"> <link rel="stylesheet" href="${request.contextPath}/static/adminlte/plugins/daterangepicker/daterangepicker.css">
<title>${I18n.admin_name}</title>
</head> </head>
<body class="hold-transition skin-blue sidebar-mini <#if cookieMap?exists && "off" == cookieMap["xxljob_adminlte_settings"].value >sidebar-collapse</#if> "> <body class="hold-transition skin-blue sidebar-mini <#if cookieMap?exists && "off" == cookieMap["xxljob_adminlte_settings"].value >sidebar-collapse</#if> ">
<div class="wrapper"> <div class="wrapper">
@ -18,7 +18,7 @@
<div class="content-wrapper"> <div class="content-wrapper">
<!-- Content Header (Page header) --> <!-- Content Header (Page header) -->
<section class="content-header"> <section class="content-header">
<h1>${I18nUtil.getString("job_dashboard_name")}</h1> <h1>${I18n.job_dashboard_name}</h1>
<!-- <!--
<h1>运行报表<small>任务调度中心</small></h1> <h1>运行报表<small>任务调度中心</small></h1>
<ol class="breadcrumb"> <ol class="breadcrumb">
@ -40,13 +40,13 @@
<span class="info-box-icon"><i class="fa fa-flag-o"></i></span> <span class="info-box-icon"><i class="fa fa-flag-o"></i></span>
<div class="info-box-content"> <div class="info-box-content">
<span class="info-box-text">${I18nUtil.getString("job_dashboard_job_num")}</span> <span class="info-box-text">${I18n.job_dashboard_job_num}</span>
<span class="info-box-number">${jobInfoCount}</span> <span class="info-box-number">${jobInfoCount}</span>
<div class="progress"> <div class="progress">
<div class="progress-bar" style="width: 100%"></div> <div class="progress-bar" style="width: 100%"></div>
</div> </div>
<span class="progress-description">${I18nUtil.getString("job_dashboard_job_num_tip")}</span> <span class="progress-description">${I18n.job_dashboard_job_num_tip}</span>
</div> </div>
</div> </div>
</div> </div>
@ -57,14 +57,14 @@
<span class="info-box-icon"><i class="fa fa-calendar"></i></span> <span class="info-box-icon"><i class="fa fa-calendar"></i></span>
<div class="info-box-content"> <div class="info-box-content">
<span class="info-box-text">${I18nUtil.getString("job_dashboard_trigger_num")}</span> <span class="info-box-text">${I18n.job_dashboard_trigger_num}</span>
<span class="info-box-number">${jobLogCount}</span> <span class="info-box-number">${jobLogCount}</span>
<div class="progress"> <div class="progress">
<div class="progress-bar" style="width: 100%" ></div> <div class="progress-bar" style="width: 100%" ></div>
</div> </div>
<span class="progress-description"> <span class="progress-description">
${I18nUtil.getString("job_dashboard_trigger_num_tip")} ${I18n.job_dashboard_trigger_num_tip}
<#--<#if jobLogCount gt 0> <#--<#if jobLogCount gt 0>
调度成功率${(jobLogSuccessCount*100/jobLogCount)?string("0.00")}<small>%</small> 调度成功率${(jobLogSuccessCount*100/jobLogCount)?string("0.00")}<small>%</small>
</#if>--> </#if>-->
@ -79,13 +79,13 @@
<span class="info-box-icon"><i class="fa ion-ios-settings-strong"></i></span> <span class="info-box-icon"><i class="fa ion-ios-settings-strong"></i></span>
<div class="info-box-content"> <div class="info-box-content">
<span class="info-box-text">${I18nUtil.getString("job_dashboard_jobgroup_num")}</span> <span class="info-box-text">${I18n.job_dashboard_jobgroup_num}</span>
<span class="info-box-number">${executorCount}</span> <span class="info-box-number">${executorCount}</span>
<div class="progress"> <div class="progress">
<div class="progress-bar" style="width: 100%"></div> <div class="progress-bar" style="width: 100%"></div>
</div> </div>
<span class="progress-description">${I18nUtil.getString("job_dashboard_jobgroup_num_tip")}</span> <span class="progress-description">${I18n.job_dashboard_jobgroup_num_tip}</span>
</div> </div>
</div> </div>
</div> </div>
@ -97,7 +97,7 @@
<div class="col-md-12"> <div class="col-md-12">
<div class="box"> <div class="box">
<div class="box-header with-border"> <div class="box-header with-border">
<h3 class="box-title">${I18nUtil.getString("job_dashboard_report")}</h3> <h3 class="box-title">${I18n.job_dashboard_report}</h3>
<#--<input type="text" class="form-control" id="filterTime" readonly >--> <#--<input type="text" class="form-control" id="filterTime" readonly >-->
<!-- tools box --> <!-- tools box -->
@ -137,9 +137,6 @@
<@netCommon.commonFooter /> <@netCommon.commonFooter />
</div> </div>
<@netCommon.commonScript /> <@netCommon.commonScript />
<script>
var system_tips = '${I18nUtil.getString("system_tips")}';
</script>
<!-- daterangepicker --> <!-- daterangepicker -->
<script src="${request.contextPath}/static/adminlte/plugins/daterangepicker/moment.min.js"></script> <script src="${request.contextPath}/static/adminlte/plugins/daterangepicker/moment.min.js"></script>
<script src="${request.contextPath}/static/adminlte/plugins/daterangepicker/daterangepicker.js"></script> <script src="${request.contextPath}/static/adminlte/plugins/daterangepicker/daterangepicker.js"></script>

View File

@ -1,11 +1,11 @@
<!DOCTYPE html> <!DOCTYPE html>
<html> <html>
<head> <head>
<title>${I18nUtil.getString("admin_name")}</title>
<#import "/common/common.macro.ftl" as netCommon> <#import "/common/common.macro.ftl" as netCommon>
<@netCommon.commonStyle /> <@netCommon.commonStyle />
<link rel="stylesheet" href="${request.contextPath}/static/plugins/codemirror/lib/codemirror.css"> <link rel="stylesheet" href="${request.contextPath}/static/plugins/codemirror/lib/codemirror.css">
<link rel="stylesheet" href="${request.contextPath}/static/plugins/codemirror/addon/hint/show-hint.css"> <link rel="stylesheet" href="${request.contextPath}/static/plugins/codemirror/addon/hint/show-hint.css">
<title>${I18n.admin_name}</title>
<style type="text/css"> <style type="text/css">
.CodeMirror { .CodeMirror {
font-size:16px; font-size:16px;

View File

@ -1,11 +1,11 @@
<!DOCTYPE html> <!DOCTYPE html>
<html> <html>
<head> <head>
<title>${I18nUtil.getString("admin_name")}</title>
<#import "/common/common.macro.ftl" as netCommon> <#import "/common/common.macro.ftl" as netCommon>
<@netCommon.commonStyle /> <@netCommon.commonStyle />
<!-- DataTables --> <!-- DataTables -->
<link rel="stylesheet" href="${request.contextPath}/static/adminlte/plugins/datatables/dataTables.bootstrap.css"> <link rel="stylesheet" href="${request.contextPath}/static/adminlte/plugins/datatables/dataTables.bootstrap.css">
<title>${I18n.admin_name}</title>
</head> </head>
<body class="hold-transition skin-blue sidebar-mini <#if cookieMap?exists && "off" == cookieMap["xxljob_adminlte_settings"].value >sidebar-collapse</#if> "> <body class="hold-transition skin-blue sidebar-mini <#if cookieMap?exists && "off" == cookieMap["xxljob_adminlte_settings"].value >sidebar-collapse</#if> ">
<div class="wrapper"> <div class="wrapper">
@ -18,7 +18,7 @@
<div class="content-wrapper"> <div class="content-wrapper">
<!-- Content Header (Page header) --> <!-- Content Header (Page header) -->
<section class="content-header"> <section class="content-header">
<h1>${I18nUtil.getString("jobgroup_name")}</h1> <h1>${I18n.jobgroup_name}</h1>
</section> </section>
<!-- Main content --> <!-- Main content -->

View File

@ -1,12 +1,11 @@
<!DOCTYPE html> <!DOCTYPE html>
<html> <html>
<head> <head>
<title>${I18nUtil.getString("admin_name")}</title>
<#import "/common/common.macro.ftl" as netCommon> <#import "/common/common.macro.ftl" as netCommon>
<@netCommon.commonStyle /> <@netCommon.commonStyle />
<!-- DataTables --> <!-- DataTables -->
<link rel="stylesheet" href="${request.contextPath}/static/adminlte/plugins/datatables/dataTables.bootstrap.css"> <link rel="stylesheet" href="${request.contextPath}/static/adminlte/plugins/datatables/dataTables.bootstrap.css">
<title>${I18n.admin_name}</title>
</head> </head>
<body class="hold-transition skin-blue sidebar-mini <#if cookieMap?exists && "off" == cookieMap["xxljob_adminlte_settings"].value >sidebar-collapse</#if>"> <body class="hold-transition skin-blue sidebar-mini <#if cookieMap?exists && "off" == cookieMap["xxljob_adminlte_settings"].value >sidebar-collapse</#if>">
<div class="wrapper"> <div class="wrapper">
@ -19,7 +18,7 @@
<div class="content-wrapper"> <div class="content-wrapper">
<!-- Content Header (Page header) --> <!-- Content Header (Page header) -->
<section class="content-header"> <section class="content-header">
<h1>${I18nUtil.getString("jobinfo_name")}</h1> <h1>${I18n.jobinfo_name}</h1>
<!-- <!--
<ol class="breadcrumb"> <ol class="breadcrumb">
<li><a><i class="fa fa-dashboard"></i>调度管理</a></li> <li><a><i class="fa fa-dashboard"></i>调度管理</a></li>

View File

@ -1,9 +1,9 @@
<!DOCTYPE html> <!DOCTYPE html>
<html> <html>
<head> <head>
<title>${I18nUtil.getString("admin_name")}</title> <#import "/common/common.macro.ftl" as netCommon>
<#import "/common/common.macro.ftl" as netCommon> <@netCommon.commonStyle />
<@netCommon.commonStyle /> <title>${I18n.admin_name}</title>
</head> </head>
<body class="hold-transition skin-blue layout-top-nav"> <body class="hold-transition skin-blue layout-top-nav">

View File

@ -1,13 +1,13 @@
<!DOCTYPE html> <!DOCTYPE html>
<html> <html>
<head> <head>
<title>${I18nUtil.getString("admin_name")}</title>
<#import "/common/common.macro.ftl" as netCommon> <#import "/common/common.macro.ftl" as netCommon>
<@netCommon.commonStyle /> <@netCommon.commonStyle />
<!-- DataTables --> <!-- DataTables -->
<link rel="stylesheet" href="${request.contextPath}/static/adminlte/plugins/datatables/dataTables.bootstrap.css"> <link rel="stylesheet" href="${request.contextPath}/static/adminlte/plugins/datatables/dataTables.bootstrap.css">
<!-- daterangepicker --> <!-- daterangepicker -->
<link rel="stylesheet" href="${request.contextPath}/static/adminlte/plugins/daterangepicker/daterangepicker.css"> <link rel="stylesheet" href="${request.contextPath}/static/adminlte/plugins/daterangepicker/daterangepicker.css">
<title>${I18n.admin_name}</title>
</head> </head>
<body class="hold-transition skin-blue sidebar-mini <#if cookieMap?exists && "off" == cookieMap["xxljob_adminlte_settings"].value >sidebar-collapse</#if> "> <body class="hold-transition skin-blue sidebar-mini <#if cookieMap?exists && "off" == cookieMap["xxljob_adminlte_settings"].value >sidebar-collapse</#if> ">
<div class="wrapper"> <div class="wrapper">
@ -20,7 +20,7 @@
<div class="content-wrapper"> <div class="content-wrapper">
<!-- Content Header (Page header) --> <!-- Content Header (Page header) -->
<section class="content-header"> <section class="content-header">
<h1>${I18nUtil.getString("joblog_name")}</h1> <h1>${I18n.joblog_name}</h1>
<!-- <!--
<ol class="breadcrumb"> <ol class="breadcrumb">
<li><a><i class="fa fa-dashboard"></i>调度日志</a></li> <li><a><i class="fa fa-dashboard"></i>调度日志</a></li>

View File

@ -1,10 +1,10 @@
<!DOCTYPE html> <!DOCTYPE html>
<html> <html>
<head> <head>
<title>${I18nUtil.getString("admin_name")}</title>
<#import "/common/common.macro.ftl" as netCommon> <#import "/common/common.macro.ftl" as netCommon>
<@netCommon.commonStyle /> <@netCommon.commonStyle />
<link rel="stylesheet" href="${request.contextPath}/static/adminlte/plugins/iCheck/square/blue.css"> <link rel="stylesheet" href="${request.contextPath}/static/adminlte/plugins/iCheck/square/blue.css">
<title>${I18n.admin_name}</title>
</head> </head>
<body class="hold-transition login-page"> <body class="hold-transition login-page">
<div class="login-box"> <div class="login-box">
@ -13,44 +13,31 @@
</div> </div>
<form id="loginForm" method="post" > <form id="loginForm" method="post" >
<div class="login-box-body"> <div class="login-box-body">
<p class="login-box-msg">${I18nUtil.getString("admin_name")}</p> <p class="login-box-msg">${I18n.admin_name}</p>
<div class="form-group has-feedback"> <div class="form-group has-feedback">
<input type="text" name="userName" class="form-control" placeholder="${I18nUtil.getString("login_username_placeholder")}" value="admin" maxlength="18" > <input type="text" name="userName" class="form-control" placeholder="${I18n.login_username_placeholder}" value="admin" maxlength="18" >
<span class="glyphicon glyphicon-envelope form-control-feedback"></span> <span class="glyphicon glyphicon-envelope form-control-feedback"></span>
</div> </div>
<div class="form-group has-feedback"> <div class="form-group has-feedback">
<input type="password" name="password" class="form-control" placeholder="${I18nUtil.getString("login_password_placeholder")}" value="123456" maxlength="18" > <input type="password" name="password" class="form-control" placeholder="${I18n.login_password_placeholder}" value="123456" maxlength="18" >
<span class="glyphicon glyphicon-lock form-control-feedback"></span> <span class="glyphicon glyphicon-lock form-control-feedback"></span>
</div> </div>
<div class="row"> <div class="row">
<div class="col-xs-8"> <div class="col-xs-8">
<div class="checkbox icheck"> <div class="checkbox icheck">
<label> <label>
<input type="checkbox" name="ifRemember" > ${I18nUtil.getString("login_remember_me")} <input type="checkbox" name="ifRemember" >${I18n.login_remember_me}
</label> </label>
</div> </div>
</div><!-- /.col --> </div><!-- /.col -->
<div class="col-xs-4"> <div class="col-xs-4">
<button type="submit" class="btn btn-primary btn-block btn-flat">${I18nUtil.getString("login_btn")}</button> <button type="submit" class="btn btn-primary btn-block btn-flat">${I18n.login_btn}</button>
</div> </div>
</div> </div>
</div> </div>
</form> </form>
</div> </div>
<@netCommon.commonScript /> <@netCommon.commonScript />
<script>
var system_tips = '${I18nUtil.getString("system_tips")}';
var system_ok = '${I18nUtil.getString("system_ok")}';
var login_username_empty = '${I18nUtil.getString("login_username_empty")}';
var login_username_lt_5 = '${I18nUtil.getString("login_username_lt_5")}';
var login_password_empty = '${I18nUtil.getString("login_password_empty")}';
var login_password_lt_5 = '${I18nUtil.getString("login_password_lt_5")}';
var login_success = '${I18nUtil.getString("login_success")}';
var login_fail = '${I18nUtil.getString("login_fail")}';
</script>
<script src="${request.contextPath}/static/plugins/jquery/jquery.validate.min.js"></script> <script src="${request.contextPath}/static/plugins/jquery/jquery.validate.min.js"></script>
<script src="${request.contextPath}/static/adminlte/plugins/iCheck/icheck.min.js"></script> <script src="${request.contextPath}/static/adminlte/plugins/iCheck/icheck.min.js"></script>
<script src="${request.contextPath}/static/js/login.1.js"></script> <script src="${request.contextPath}/static/js/login.1.js"></script>

View File

@ -2,18 +2,18 @@ $(function(){
// logout // logout
$("#logoutBtn").click(function(){ $("#logoutBtn").click(function(){
layer.confirm(logout_confirm, {icon: 3, title:system_tips}, function(index){ layer.confirm( I18n.logout_confirm , {icon: 3, title: I18n.system_tips }, function(index){
layer.close(index); layer.close(index);
$.post(base_url + "/logout", function(data, status) { $.post(base_url + "/logout", function(data, status) {
if (data.code == "200") { if (data.code == "200") {
layer.msg(logout_success); layer.msg( I18n.logout_success );
setTimeout(function(){ setTimeout(function(){
window.location.href = base_url + "/"; window.location.href = base_url + "/";
}, 500); }, 500);
/*layer.open({ /*layer.open({
title: '系统提示', title: I18n.system_tips ,
content: '注销成功', content: I18n.logout_success ,
icon: '1', icon: '1',
end: function(layero, index){ end: function(layero, index){
window.location.href = base_url + "/"; window.location.href = base_url + "/";
@ -21,9 +21,9 @@ $(function(){
});*/ });*/
} else { } else {
layer.open({ layer.open({
title: system_tips, title: I18n.system_tips ,
btn: [system_ok, system_close], btn: [ I18n.system_ok , I18n.system_close ],
content: (data.msg || logout_fail), content: (data.msg || I18n.logout_fail),
icon: '2' icon: '2'
}); });
} }
@ -74,9 +74,9 @@ $(function(){
}, 100); }, 100);
}); });
// 左侧菜单状态js + 后端 + cookie方式 // left menu status v: js + server + cookie
$('.sidebar-toggle').click(function(){ $('.sidebar-toggle').click(function(){
var xxljob_adminlte_settings = $.cookie('xxljob_adminlte_settings'); // 左侧菜单展开状态[xxljob_adminlte_settings]on=展开off=折叠 var xxljob_adminlte_settings = $.cookie('xxljob_adminlte_settings'); // on=openoff=close
if ('off' == xxljob_adminlte_settings) { if ('off' == xxljob_adminlte_settings) {
xxljob_adminlte_settings = 'on'; xxljob_adminlte_settings = 'on';
} else { } else {
@ -84,11 +84,12 @@ $(function(){
} }
$.cookie('xxljob_adminlte_settings', xxljob_adminlte_settings, { expires: 7 }); //$.cookie('the_cookie', '', { expires: -1 }); $.cookie('xxljob_adminlte_settings', xxljob_adminlte_settings, { expires: 7 }); //$.cookie('the_cookie', '', { expires: -1 });
}); });
// 左侧菜单状态js + cookie方式遗弃
// left menu status v1: js + cookie
/* /*
var xxljob_adminlte_settings = $.cookie('xxljob_adminlte_settings'); var xxljob_adminlte_settings = $.cookie('xxljob_adminlte_settings');
if (xxljob_adminlte_settings == 'off') { if (xxljob_adminlte_settings == 'off') {
$('body').addClass('sidebar-collapse'); $('body').addClass('sidebar-collapse');
} }
*/ */

View File

@ -63,7 +63,7 @@ $(function () {
pieChartInit(data); pieChartInit(data);
} else { } else {
layer.open({ layer.open({
title: system_tips, title: I18n.system_tips ,
content: (data.msg || '调度报表数据加载异常'), content: (data.msg || '调度报表数据加载异常'),
icon: '2' icon: '2'
}); });

View File

@ -1,12 +1,13 @@
$(function(){ $(function(){
// 复选框
// input iCheck
$('input').iCheck({ $('input').iCheck({
checkboxClass: 'icheckbox_square-blue', checkboxClass: 'icheckbox_square-blue',
radioClass: 'iradio_square-blue', radioClass: 'iradio_square-blue',
increaseArea: '20%' // optional increaseArea: '20%' // optional
}); });
// 登录.规则校验 // login Form Valid
var loginFormValid = $("#loginForm").validate({ var loginFormValid = $("#loginForm").validate({
errorElement : 'span', errorElement : 'span',
errorClass : 'help-block', errorClass : 'help-block',
@ -25,12 +26,12 @@ $(function(){
}, },
messages : { messages : {
userName : { userName : {
required : login_username_empty, required : I18n.login_username_empty,
minlength : login_username_lt_5 minlength : I18n.login_username_lt_5
}, },
password : { password : {
required : login_password_empty , required : I18n.login_password_empty ,
minlength : login_password_lt_5 minlength : I18n.login_password_lt_5
/*,maxlength:"登录密码不应超过18位"*/ /*,maxlength:"登录密码不应超过18位"*/
} }
}, },
@ -47,13 +48,13 @@ $(function(){
submitHandler : function(form) { submitHandler : function(form) {
$.post(base_url + "/login", $("#loginForm").serialize(), function(data, status) { $.post(base_url + "/login", $("#loginForm").serialize(), function(data, status) {
if (data.code == "200") { if (data.code == "200") {
layer.msg(login_success); layer.msg( I18n.login_success );
setTimeout(function(){ setTimeout(function(){
window.location.href = base_url; window.location.href = base_url;
}, 500); }, 500);
/*layer.open({ /*layer.open({
title: '系统提示', title: I18n.system_tips,
content: '登录成功', content: I18n.login_success,
icon: '1', icon: '1',
end: function(layero, index){ end: function(layero, index){
window.location.href = base_url; window.location.href = base_url;
@ -61,9 +62,9 @@ $(function(){
});*/ });*/
} else { } else {
layer.open({ layer.open({
title: system_tips, title: I18n.system_tips,
btn: [system_ok], btn: [ I18n.system_ok ],
content: (data.msg || login_fail), content: (data.msg || I18n.login_fail ),
icon: '2' icon: '2'
}); });
} }

View File

@ -0,0 +1,20 @@
package com.xxl.job.admin.util;
import com.xxl.job.admin.core.util.I18nUtil;
import org.junit.Test;
/**
* email util test
*
* @author xuxueli 2017-12-22 17:16:23
*/
public class I18nUtilTest {
@Test
public void test(){
System.out.println(I18nUtil.getString("admin_name"));
System.out.println(I18nUtil.getMultString("admin_name", "admin_name_full"));
System.out.println(I18nUtil.getMultString());
}
}