xuxueli пре 7 година
родитељ
комит
84f093ab42

+ 36 - 5
xxl-job-admin/src/main/java/com/xxl/job/admin/core/util/I18nUtil.java Прегледај датотеку

@@ -1,5 +1,6 @@
1 1
 package com.xxl.job.admin.core.util;
2 2
 
3
+import com.xxl.job.core.util.JacksonUtil;
3 4
 import org.slf4j.Logger;
4 5
 import org.slf4j.LoggerFactory;
5 6
 import org.springframework.core.io.ClassPathResource;
@@ -8,6 +9,8 @@ import org.springframework.core.io.support.EncodedResource;
8 9
 import org.springframework.core.io.support.PropertiesLoaderUtils;
9 10
 
10 11
 import java.io.IOException;
12
+import java.util.HashMap;
13
+import java.util.Map;
11 14
 import java.util.Properties;
12 15
 
13 16
 /**
@@ -19,14 +22,12 @@ public class I18nUtil {
19 22
     private static Logger logger = LoggerFactory.getLogger(I18nUtil.class);
20 23
 
21 24
     private static final String i18n_file = "i18n/message.properties";
22
-    private static Properties prop = null;
23
-    private static boolean prop_cache = false;
24 25
 
26
+    private static Properties prop = null;
25 27
     public static Properties loadI18nProp(){
26
-        if (prop_cache && prop != null) {
27
-            return prop;
28
+        if (prop != null) {
29
+            //return prop;
28 30
         }
29
-
30 31
         try {
31 32
             Resource resource = new ClassPathResource(i18n_file);
32 33
             EncodedResource encodedResource = new EncodedResource(resource,"UTF-8");
@@ -37,8 +38,38 @@ public class I18nUtil {
37 38
         return prop;
38 39
     }
39 40
 
41
+    /**
42
+     * get val of i18n key
43
+     *
44
+     * @param key
45
+     * @return
46
+     */
40 47
     public static String getString(String key) {
41 48
         return loadI18nProp().getProperty(key);
42 49
     }
43 50
 
51
+    /**
52
+     * get mult val of i18n mult key, as json
53
+     *
54
+     * @param keys
55
+     * @return
56
+     */
57
+    public static String getMultString(String... keys) {
58
+        Map<String, String> map = new HashMap<>();
59
+
60
+        Properties prop = loadI18nProp();
61
+        if (keys!=null && keys.length>0) {
62
+            for (String key: keys) {
63
+                map.put(key, prop.getProperty(key));
64
+            }
65
+        } else {
66
+            for (String key: prop.stringPropertyNames()) {
67
+                map.put(key, prop.getProperty(key));
68
+            }
69
+        }
70
+
71
+        String json = JacksonUtil.writeValueAsString(map);
72
+        return json;
73
+    }
74
+
44 75
 }

+ 1 - 0
xxl-job-admin/src/main/resources/i18n/message.properties Прегледај датотеку

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

+ 13 - 16
xxl-job-admin/src/main/webapp/WEB-INF/template/common/common.macro.ftl Прегледај датотеку

@@ -29,6 +29,10 @@
29 29
 
30 30
 	<!-- pace -->
31 31
 	<link rel="stylesheet" href="${request.contextPath}/static/plugins/pace/themes/pace-theme-flash.css">
32
+
33
+	<#-- i18n -->
34
+	<#global I18n = I18nUtil.getMultString()?eval />
35
+
32 36
 </#macro>
33 37
 
34 38
 <#macro commonScript>
@@ -55,14 +59,7 @@
55 59
     <script src="${request.contextPath}/static/js/common.1.js"></script>
56 60
     <script>
57 61
 		var base_url = '${request.contextPath}';
58
-
59
-		var system_tips = '${I18nUtil.getString("system_tips")}';
60
-        var system_ok = '${I18nUtil.getString("system_ok")}';
61
-        var system_close = '${I18nUtil.getString("system_close")}';
62
-
63
-        var logout_confirm = '${I18nUtil.getString("logout_confirm")}';
64
-        var logout_success = '${I18nUtil.getString("logout_success")}';
65
-        var logout_fail = '${I18nUtil.getString("logout_fail")}';
62
+        var I18n = ${I18nUtil.getMultString()};
66 63
 	</script>
67 64
 
68 65
 </#macro>
@@ -71,7 +68,7 @@
71 68
 	<header class="main-header">
72 69
 		<a href="${request.contextPath}/" class="logo">
73 70
 			<span class="logo-mini"><b>XXL</b></span>
74
-			<span class="logo-lg"><b>${I18nUtil.getString("admin_name")}</b></span>
71
+			<span class="logo-lg"><b>${I18n.admin_name}</b></span>
75 72
 		</a>
76 73
 		<nav class="navbar navbar-static-top" role="navigation">
77 74
 			<a href="#" class="sidebar-toggle" data-toggle="offcanvas" role="button"><span class="sr-only">切换导航</span></a>
@@ -79,7 +76,7 @@
79 76
 				<ul class="nav navbar-nav">
80 77
 					<li class="dropdown user user-menu">
81 78
 	                    <a href=";" id="logoutBtn" class="dropdown-toggle" data-toggle="dropdown" aria-expanded="false">
82
-                      		<span class="hidden-xs">${I18nUtil.getString("logout_btn")}</span>
79
+                      		<span class="hidden-xs">${I18n.logout_btn}</span>
83 80
 	                    </a>
84 81
 					</li>
85 82
 				</ul>
@@ -95,11 +92,11 @@
95 92
 		<section class="sidebar">
96 93
 			<!-- sidebar menu: : style can be found in sidebar.less -->
97 94
 			<ul class="sidebar-menu">
98
-				<#--<li class="header">常用模块</li>-->
99
-				<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>
100
-				<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>
101
-                <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>
102
-				<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>
95
+                <li class="header">导航</li>
96
+				<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>
97
+				<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>
98
+                <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>
99
+				<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>
103 100
 			</ul>
104 101
 		</section>
105 102
 		<!-- /.sidebar -->
@@ -185,7 +182,7 @@
185 182
 
186 183
 <#macro commonFooter >
187 184
 	<footer class="main-footer">
188
-        Powered by <b>XXL-JOB</b> 1.9.1(SNAPSHOT)
185
+        Powered by <b>XXL-JOB</b> ${I18n.admin_version}
189 186
 		<div class="pull-right hidden-xs">
190 187
             <strong>Copyright &copy; 2015-${.now?string('yyyy')} &nbsp;
191 188
                 <a href="http://www.xuxueli.com/" target="_blank" >xuxueli</a>

+ 4 - 10
xxl-job-admin/src/main/webapp/WEB-INF/template/help.ftl Прегледај датотеку

@@ -1,9 +1,9 @@
1 1
 <!DOCTYPE html>
2 2
 <html>
3 3
 <head>
4
-    <title>${I18nUtil.getString("admin_name")}</title>
5 4
   	<#import "/common/common.macro.ftl" as netCommon>
6 5
 	<@netCommon.commonStyle />
6
+	<title>${I18n.admin_name}</title>
7 7
 </head>
8 8
 <body class="hold-transition skin-blue sidebar-mini <#if cookieMap?exists && "off" == cookieMap["xxljob_adminlte_settings"].value >sidebar-collapse</#if> ">
9 9
 <div class="wrapper">
@@ -16,25 +16,19 @@
16 16
 	<div class="content-wrapper">
17 17
 		<!-- Content Header (Page header) -->
18 18
 		<section class="content-header">
19
-			<h1>${I18nUtil.getString("job_help")}</h1>
20
-			<!--
21
-			<ol class="breadcrumb">
22
-				<li><a><i class="fa fa-dashboard"></i>调度中心</a></li>
23
-				<li class="active">使用教程</li>
24
-			</ol>
25
-			-->
19
+			<h1>${I18n.job_help}</h1>
26 20
 		</section>
27 21
 
28 22
 		<!-- Main content -->
29 23
 		<section class="content">
30 24
 			<div class="callout callout-info">
31
-				<h4>${I18nUtil.getString("admin_name_full")}</h4>
25
+				<h4>${I18n.admin_name_full}</h4>
32 26
 				<br>
33 27
 				<p>
34 28
 					<a target="_blank" href="https://github.com/xuxueli/xxl-job">github</a>&nbsp;&nbsp;&nbsp;&nbsp;
35 29
 					<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> 
36 30
 					<br><br>
37
-                    <a target="_blank" href="http://www.xuxueli.com/xxl-job/">${I18nUtil.getString("job_help_document")}</a>
31
+                    <a target="_blank" href="http://www.xuxueli.com/xxl-job/">${I18n.job_help_document}</a>
38 32
                     <br><br>
39 33
 
40 34
 				</p>

+ 9 - 12
xxl-job-admin/src/main/webapp/WEB-INF/template/index.ftl Прегледај датотеку

@@ -1,11 +1,11 @@
1 1
 <!DOCTYPE html>
2 2
 <html>
3 3
 <head>
4
-    <title>${I18nUtil.getString("admin_name")}</title>
5 4
   	<#import "/common/common.macro.ftl" as netCommon>
6 5
 	<@netCommon.commonStyle />
7 6
     <!-- daterangepicker -->
8 7
     <link rel="stylesheet" href="${request.contextPath}/static/adminlte/plugins/daterangepicker/daterangepicker.css">
8
+    <title>${I18n.admin_name}</title>
9 9
 </head>
10 10
 <body class="hold-transition skin-blue sidebar-mini <#if cookieMap?exists && "off" == cookieMap["xxljob_adminlte_settings"].value >sidebar-collapse</#if> ">
11 11
 <div class="wrapper">
@@ -18,7 +18,7 @@
18 18
 	<div class="content-wrapper">
19 19
 		<!-- Content Header (Page header) -->
20 20
 		<section class="content-header">
21
-			<h1>${I18nUtil.getString("job_dashboard_name")}</h1>
21
+			<h1>${I18n.job_dashboard_name}</h1>
22 22
 			<!--
23 23
 			<h1>运行报表<small>任务调度中心</small></h1>
24 24
 			<ol class="breadcrumb">
@@ -40,13 +40,13 @@
40 40
                         <span class="info-box-icon"><i class="fa fa-flag-o"></i></span>
41 41
 
42 42
                         <div class="info-box-content">
43
-                            <span class="info-box-text">${I18nUtil.getString("job_dashboard_job_num")}</span>
43
+                            <span class="info-box-text">${I18n.job_dashboard_job_num}</span>
44 44
                             <span class="info-box-number">${jobInfoCount}</span>
45 45
 
46 46
                             <div class="progress">
47 47
                                 <div class="progress-bar" style="width: 100%"></div>
48 48
                             </div>
49
-                            <span class="progress-description">${I18nUtil.getString("job_dashboard_job_num_tip")}</span>
49
+                            <span class="progress-description">${I18n.job_dashboard_job_num_tip}</span>
50 50
                         </div>
51 51
                     </div>
52 52
                 </div>
@@ -57,14 +57,14 @@
57 57
                         <span class="info-box-icon"><i class="fa fa-calendar"></i></span>
58 58
 
59 59
                         <div class="info-box-content">
60
-                            <span class="info-box-text">${I18nUtil.getString("job_dashboard_trigger_num")}</span>
60
+                            <span class="info-box-text">${I18n.job_dashboard_trigger_num}</span>
61 61
                             <span class="info-box-number">${jobLogCount}</span>
62 62
 
63 63
                             <div class="progress">
64 64
                                 <div class="progress-bar" style="width: 100%" ></div>
65 65
                             </div>
66 66
                             <span class="progress-description">
67
-                                ${I18nUtil.getString("job_dashboard_trigger_num_tip")}
67
+                                ${I18n.job_dashboard_trigger_num_tip}
68 68
                                 <#--<#if jobLogCount gt 0>
69 69
                                     调度成功率:${(jobLogSuccessCount*100/jobLogCount)?string("0.00")}<small>%</small>
70 70
                                 </#if>-->
@@ -79,13 +79,13 @@
79 79
                         <span class="info-box-icon"><i class="fa ion-ios-settings-strong"></i></span>
80 80
 
81 81
                         <div class="info-box-content">
82
-                            <span class="info-box-text">${I18nUtil.getString("job_dashboard_jobgroup_num")}</span>
82
+                            <span class="info-box-text">${I18n.job_dashboard_jobgroup_num}</span>
83 83
                             <span class="info-box-number">${executorCount}</span>
84 84
 
85 85
                             <div class="progress">
86 86
                                 <div class="progress-bar" style="width: 100%"></div>
87 87
                             </div>
88
-                            <span class="progress-description">${I18nUtil.getString("job_dashboard_jobgroup_num_tip")}</span>
88
+                            <span class="progress-description">${I18n.job_dashboard_jobgroup_num_tip}</span>
89 89
                         </div>
90 90
                     </div>
91 91
                 </div>
@@ -97,7 +97,7 @@
97 97
                 <div class="col-md-12">
98 98
                     <div class="box">
99 99
                         <div class="box-header with-border">
100
-                            <h3 class="box-title">${I18nUtil.getString("job_dashboard_report")}</h3>
100
+                            <h3 class="box-title">${I18n.job_dashboard_report}</h3>
101 101
                             <#--<input type="text" class="form-control" id="filterTime" readonly >-->
102 102
 
103 103
                             <!-- tools box -->
@@ -137,9 +137,6 @@
137 137
 	<@netCommon.commonFooter />
138 138
 </div>
139 139
 <@netCommon.commonScript />
140
-<script>
141
-var system_tips = '${I18nUtil.getString("system_tips")}';
142
-</script>
143 140
 <!-- daterangepicker -->
144 141
 <script src="${request.contextPath}/static/adminlte/plugins/daterangepicker/moment.min.js"></script>
145 142
 <script src="${request.contextPath}/static/adminlte/plugins/daterangepicker/daterangepicker.js"></script>

+ 1 - 1
xxl-job-admin/src/main/webapp/WEB-INF/template/jobcode/jobcode.index.ftl Прегледај датотеку

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

+ 2 - 2
xxl-job-admin/src/main/webapp/WEB-INF/template/jobgroup/jobgroup.index.ftl Прегледај датотеку

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

+ 2 - 3
xxl-job-admin/src/main/webapp/WEB-INF/template/jobinfo/jobinfo.index.ftl Прегледај датотеку

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

+ 3 - 3
xxl-job-admin/src/main/webapp/WEB-INF/template/joblog/joblog.detail.ftl Прегледај датотеку

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

+ 2 - 2
xxl-job-admin/src/main/webapp/WEB-INF/template/joblog/joblog.index.ftl Прегледај датотеку

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

+ 6 - 19
xxl-job-admin/src/main/webapp/WEB-INF/template/login.ftl Прегледај датотеку

@@ -1,10 +1,10 @@
1 1
 <!DOCTYPE html>
2 2
 <html>
3 3
 <head>
4
-  	<title>${I18nUtil.getString("admin_name")}</title>
5 4
   	<#import "/common/common.macro.ftl" as netCommon>
6 5
 	<@netCommon.commonStyle />
7 6
     <link rel="stylesheet" href="${request.contextPath}/static/adminlte/plugins/iCheck/square/blue.css">
7
+	<title>${I18n.admin_name}</title>
8 8
 </head>
9 9
 <body class="hold-transition login-page">
10 10
 	<div class="login-box">
@@ -13,44 +13,31 @@
13 13
 		</div>
14 14
 		<form id="loginForm" method="post" >
15 15
 			<div class="login-box-body">
16
-				<p class="login-box-msg">${I18nUtil.getString("admin_name")}</p>
16
+				<p class="login-box-msg">${I18n.admin_name}</p>
17 17
 				<div class="form-group has-feedback">
18
-	            	<input type="text" name="userName" class="form-control" placeholder="${I18nUtil.getString("login_username_placeholder")}" value="admin" maxlength="18" >
18
+	            	<input type="text" name="userName" class="form-control" placeholder="${I18n.login_username_placeholder}" value="admin" maxlength="18" >
19 19
 	            	<span class="glyphicon glyphicon-envelope form-control-feedback"></span>
20 20
 				</div>
21 21
 	          	<div class="form-group has-feedback">
22
-	            	<input type="password" name="password" class="form-control" placeholder="${I18nUtil.getString("login_password_placeholder")}" value="123456" maxlength="18" >
22
+	            	<input type="password" name="password" class="form-control" placeholder="${I18n.login_password_placeholder}" value="123456" maxlength="18" >
23 23
 	            	<span class="glyphicon glyphicon-lock form-control-feedback"></span>
24 24
 	          	</div>
25 25
 				<div class="row">
26 26
 					<div class="col-xs-8">
27 27
 		              	<div class="checkbox icheck">
28 28
 		                	<label>
29
-		                  		<input type="checkbox" name="ifRemember" > ${I18nUtil.getString("login_remember_me")}
29
+		                  		<input type="checkbox" name="ifRemember" >${I18n.login_remember_me}
30 30
 		                	</label>
31 31
 						</div>
32 32
 		            </div><!-- /.col -->
33 33
 		            <div class="col-xs-4">
34
-						<button type="submit" class="btn btn-primary btn-block btn-flat">${I18nUtil.getString("login_btn")}</button>
34
+						<button type="submit" class="btn btn-primary btn-block btn-flat">${I18n.login_btn}</button>
35 35
 					</div>
36 36
 				</div>
37 37
 			</div>
38 38
 		</form>
39 39
 	</div>
40 40
 <@netCommon.commonScript />
41
-<script>
42
-var system_tips = '${I18nUtil.getString("system_tips")}';
43
-var system_ok = '${I18nUtil.getString("system_ok")}';
44
-
45
-var login_username_empty = '${I18nUtil.getString("login_username_empty")}';
46
-var login_username_lt_5 = '${I18nUtil.getString("login_username_lt_5")}';
47
-
48
-var login_password_empty = '${I18nUtil.getString("login_password_empty")}';
49
-var login_password_lt_5 = '${I18nUtil.getString("login_password_lt_5")}';
50
-
51
-var login_success = '${I18nUtil.getString("login_success")}';
52
-var login_fail = '${I18nUtil.getString("login_fail")}';
53
-</script>
54 41
 <script src="${request.contextPath}/static/plugins/jquery/jquery.validate.min.js"></script>
55 42
 <script src="${request.contextPath}/static/adminlte/plugins/iCheck/icheck.min.js"></script>
56 43
 <script src="${request.contextPath}/static/js/login.1.js"></script>

+ 12 - 11
xxl-job-admin/src/main/webapp/static/js/common.1.js Прегледај датотеку

@@ -2,18 +2,18 @@ $(function(){
2 2
 
3 3
 	// logout
4 4
 	$("#logoutBtn").click(function(){
5
-		layer.confirm(logout_confirm, {icon: 3, title:system_tips}, function(index){
5
+		layer.confirm( I18n.logout_confirm , {icon: 3, title: I18n.system_tips }, function(index){
6 6
 			layer.close(index);
7 7
 
8 8
 			$.post(base_url + "/logout", function(data, status) {
9 9
 				if (data.code == "200") {
10
-                    layer.msg(logout_success);
10
+                    layer.msg( I18n.logout_success );
11 11
                     setTimeout(function(){
12 12
                         window.location.href = base_url + "/";
13 13
                     }, 500);
14 14
 					/*layer.open({
15
-						title: '系统提示',
16
-						content: '注销成功',
15
+						title: I18n.system_tips ,
16
+						content: I18n.logout_success ,
17 17
 						icon: '1',
18 18
 						end: function(layero, index){
19 19
 							window.location.href = base_url + "/";
@@ -21,9 +21,9 @@ $(function(){
21 21
 					});*/
22 22
 				} else {
23 23
 					layer.open({
24
-						title: system_tips,
25
-                        btn: [system_ok, system_close],
26
-						content: (data.msg || logout_fail),
24
+						title: I18n.system_tips ,
25
+                        btn: [ I18n.system_ok , I18n.system_close ],
26
+						content: (data.msg || I18n.logout_fail),
27 27
 						icon: '2'
28 28
 					});
29 29
 				}
@@ -74,9 +74,9 @@ $(function(){
74 74
 		}, 100);
75 75
 	});
76 76
 
77
-	// 左侧菜单状态,js + 后端 + cookie方式(新)
77
+	// left menu status v: js + server + cookie
78 78
 	$('.sidebar-toggle').click(function(){
79
-		var xxljob_adminlte_settings = $.cookie('xxljob_adminlte_settings');	// 左侧菜单展开状态[xxljob_adminlte_settings]:on=展开,off=折叠
79
+		var xxljob_adminlte_settings = $.cookie('xxljob_adminlte_settings');	// on=open,off=close
80 80
 		if ('off' == xxljob_adminlte_settings) {
81 81
             xxljob_adminlte_settings = 'on';
82 82
 		} else {
@@ -84,11 +84,12 @@ $(function(){
84 84
 		}
85 85
 		$.cookie('xxljob_adminlte_settings', xxljob_adminlte_settings, { expires: 7 });	//$.cookie('the_cookie', '', { expires: -1 });
86 86
 	});
87
-	// 左侧菜单状态,js + cookie方式(遗弃)
87
+
88
+	// left menu status v1: js + cookie
88 89
 	/*
89 90
 	 var xxljob_adminlte_settings = $.cookie('xxljob_adminlte_settings');
90 91
 	 if (xxljob_adminlte_settings == 'off') {
91
-	 $('body').addClass('sidebar-collapse');
92
+	 	$('body').addClass('sidebar-collapse');
92 93
 	 }
93 94
 	 */
94 95
 	

+ 1 - 1
xxl-job-admin/src/main/webapp/static/js/index.js Прегледај датотеку

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

+ 13 - 12
xxl-job-admin/src/main/webapp/static/js/login.1.js Прегледај датотеку

@@ -1,12 +1,13 @@
1 1
 $(function(){
2
-	// 复选框
2
+
3
+	// input iCheck
3 4
     $('input').iCheck({
4 5
       checkboxClass: 'icheckbox_square-blue',
5 6
       radioClass: 'iradio_square-blue',
6 7
       increaseArea: '20%' // optional
7 8
     });
8 9
     
9
-	// 登录.规则校验
10
+	// login Form Valid
10 11
 	var loginFormValid = $("#loginForm").validate({
11 12
 		errorElement : 'span',  
12 13
         errorClass : 'help-block',
@@ -25,12 +26,12 @@ $(function(){
25 26
         }, 
26 27
         messages : {  
27 28
         	userName : {  
28
-                required  : login_username_empty,
29
-                minlength : login_username_lt_5
29
+                required  : I18n.login_username_empty,
30
+                minlength : I18n.login_username_lt_5
30 31
             },
31 32
             password : {
32
-            	required  : login_password_empty  ,
33
-                minlength : login_password_lt_5
33
+            	required  : I18n.login_password_empty  ,
34
+                minlength : I18n.login_password_lt_5
34 35
                 /*,maxlength:"登录密码不应超过18位"*/
35 36
             }
36 37
         }, 
@@ -47,13 +48,13 @@ $(function(){
47 48
         submitHandler : function(form) {
48 49
 			$.post(base_url + "/login", $("#loginForm").serialize(), function(data, status) {
49 50
 				if (data.code == "200") {
50
-                    layer.msg(login_success);
51
+                    layer.msg( I18n.login_success );
51 52
                     setTimeout(function(){
52 53
                         window.location.href = base_url;
53 54
                     }, 500);
54 55
                     /*layer.open({
55
-                        title: '系统提示',
56
-                        content: '登录成功',
56
+                        title: I18n.system_tips,
57
+                        content: I18n.login_success,
57 58
                         icon: '1',
58 59
                         end: function(layero, index){
59 60
                             window.location.href = base_url;
@@ -61,9 +62,9 @@ $(function(){
61 62
                     });*/
62 63
 				} else {
63 64
                     layer.open({
64
-                        title: system_tips,
65
-                        btn: [system_ok],
66
-                        content: (data.msg || login_fail),
65
+                        title: I18n.system_tips,
66
+                        btn: [ I18n.system_ok ],
67
+                        content: (data.msg || I18n.login_fail ),
67 68
                         icon: '2'
68 69
                     });
69 70
 				}

+ 20 - 0
xxl-job-admin/src/test/java/com/xxl/job/admin/util/I18nUtilTest.java Прегледај датотеку

@@ -0,0 +1,20 @@
1
+package com.xxl.job.admin.util;
2
+
3
+import com.xxl.job.admin.core.util.I18nUtil;
4
+import org.junit.Test;
5
+
6
+/**
7
+ * email util test
8
+ *
9
+ * @author xuxueli 2017-12-22 17:16:23
10
+ */
11
+public class I18nUtilTest {
12
+
13
+    @Test
14
+    public void test(){
15
+        System.out.println(I18nUtil.getString("admin_name"));
16
+        System.out.println(I18nUtil.getMultString("admin_name", "admin_name_full"));
17
+        System.out.println(I18nUtil.getMultString());
18
+    }
19
+
20
+}