xuxueli пре 8 година
родитељ
комит
97d7fa2d6e

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

1
 package com.xxl.job.admin.core.util;
1
 package com.xxl.job.admin.core.util;
2
 
2
 
3
+import com.xxl.job.core.util.JacksonUtil;
3
 import org.slf4j.Logger;
4
 import org.slf4j.Logger;
4
 import org.slf4j.LoggerFactory;
5
 import org.slf4j.LoggerFactory;
5
 import org.springframework.core.io.ClassPathResource;
6
 import org.springframework.core.io.ClassPathResource;
8
 import org.springframework.core.io.support.PropertiesLoaderUtils;
9
 import org.springframework.core.io.support.PropertiesLoaderUtils;
9
 
10
 
10
 import java.io.IOException;
11
 import java.io.IOException;
12
+import java.util.HashMap;
13
+import java.util.Map;
11
 import java.util.Properties;
14
 import java.util.Properties;
12
 
15
 
13
 /**
16
 /**
19
     private static Logger logger = LoggerFactory.getLogger(I18nUtil.class);
22
     private static Logger logger = LoggerFactory.getLogger(I18nUtil.class);
20
 
23
 
21
     private static final String i18n_file = "i18n/message.properties";
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
     public static Properties loadI18nProp(){
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
         try {
31
         try {
31
             Resource resource = new ClassPathResource(i18n_file);
32
             Resource resource = new ClassPathResource(i18n_file);
32
             EncodedResource encodedResource = new EncodedResource(resource,"UTF-8");
33
             EncodedResource encodedResource = new EncodedResource(resource,"UTF-8");
37
         return prop;
38
         return prop;
38
     }
39
     }
39
 
40
 
41
+    /**
42
+     * get val of i18n key
43
+     *
44
+     * @param key
45
+     * @return
46
+     */
40
     public static String getString(String key) {
47
     public static String getString(String key) {
41
         return loadI18nProp().getProperty(key);
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
 admin_name=任务调度中心
1
 admin_name=任务调度中心
2
 admin_name_full=分布式任务调度平台XXL-JOB
2
 admin_name_full=分布式任务调度平台XXL-JOB
3
+admin_version=1.9.1(快照版本)
3
 
4
 
4
 ## system
5
 ## system
5
 system_tips=系统提示
6
 system_tips=系统提示

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

29
 
29
 
30
 	<!-- pace -->
30
 	<!-- pace -->
31
 	<link rel="stylesheet" href="${request.contextPath}/static/plugins/pace/themes/pace-theme-flash.css">
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
 </#macro>
36
 </#macro>
33
 
37
 
34
 <#macro commonScript>
38
 <#macro commonScript>
55
     <script src="${request.contextPath}/static/js/common.1.js"></script>
59
     <script src="${request.contextPath}/static/js/common.1.js"></script>
56
     <script>
60
     <script>
57
 		var base_url = '${request.contextPath}';
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
 	</script>
63
 	</script>
67
 
64
 
68
 </#macro>
65
 </#macro>
71
 	<header class="main-header">
68
 	<header class="main-header">
72
 		<a href="${request.contextPath}/" class="logo">
69
 		<a href="${request.contextPath}/" class="logo">
73
 			<span class="logo-mini"><b>XXL</b></span>
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
 		</a>
72
 		</a>
76
 		<nav class="navbar navbar-static-top" role="navigation">
73
 		<nav class="navbar navbar-static-top" role="navigation">
77
 			<a href="#" class="sidebar-toggle" data-toggle="offcanvas" role="button"><span class="sr-only">切换导航</span></a>
74
 			<a href="#" class="sidebar-toggle" data-toggle="offcanvas" role="button"><span class="sr-only">切换导航</span></a>
79
 				<ul class="nav navbar-nav">
76
 				<ul class="nav navbar-nav">
80
 					<li class="dropdown user user-menu">
77
 					<li class="dropdown user user-menu">
81
 	                    <a href=";" id="logoutBtn" class="dropdown-toggle" data-toggle="dropdown" aria-expanded="false">
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
 	                    </a>
80
 	                    </a>
84
 					</li>
81
 					</li>
85
 				</ul>
82
 				</ul>
95
 		<section class="sidebar">
92
 		<section class="sidebar">
96
 			<!-- sidebar menu: : style can be found in sidebar.less -->
93
 			<!-- sidebar menu: : style can be found in sidebar.less -->
97
 			<ul class="sidebar-menu">
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
 			</ul>
100
 			</ul>
104
 		</section>
101
 		</section>
105
 		<!-- /.sidebar -->
102
 		<!-- /.sidebar -->
185
 
182
 
186
 <#macro commonFooter >
183
 <#macro commonFooter >
187
 	<footer class="main-footer">
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
 		<div class="pull-right hidden-xs">
186
 		<div class="pull-right hidden-xs">
190
             <strong>Copyright &copy; 2015-${.now?string('yyyy')} &nbsp;
187
             <strong>Copyright &copy; 2015-${.now?string('yyyy')} &nbsp;
191
                 <a href="http://www.xuxueli.com/" target="_blank" >xuxueli</a>
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
 <!DOCTYPE html>
1
 <!DOCTYPE html>
2
 <html>
2
 <html>
3
 <head>
3
 <head>
4
-    <title>${I18nUtil.getString("admin_name")}</title>
5
   	<#import "/common/common.macro.ftl" as netCommon>
4
   	<#import "/common/common.macro.ftl" as netCommon>
6
 	<@netCommon.commonStyle />
5
 	<@netCommon.commonStyle />
6
+	<title>${I18n.admin_name}</title>
7
 </head>
7
 </head>
8
 <body class="hold-transition skin-blue sidebar-mini <#if cookieMap?exists && "off" == cookieMap["xxljob_adminlte_settings"].value >sidebar-collapse</#if> ">
8
 <body class="hold-transition skin-blue sidebar-mini <#if cookieMap?exists && "off" == cookieMap["xxljob_adminlte_settings"].value >sidebar-collapse</#if> ">
9
 <div class="wrapper">
9
 <div class="wrapper">
16
 	<div class="content-wrapper">
16
 	<div class="content-wrapper">
17
 		<!-- Content Header (Page header) -->
17
 		<!-- Content Header (Page header) -->
18
 		<section class="content-header">
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
 		</section>
20
 		</section>
27
 
21
 
28
 		<!-- Main content -->
22
 		<!-- Main content -->
29
 		<section class="content">
23
 		<section class="content">
30
 			<div class="callout callout-info">
24
 			<div class="callout callout-info">
31
-				<h4>${I18nUtil.getString("admin_name_full")}</h4>
25
+				<h4>${I18n.admin_name_full}</h4>
32
 				<br>
26
 				<br>
33
 				<p>
27
 				<p>
34
 					<a target="_blank" href="https://github.com/xuxueli/xxl-job">github</a>&nbsp;&nbsp;&nbsp;&nbsp;
28
 					<a target="_blank" href="https://github.com/xuxueli/xxl-job">github</a>&nbsp;&nbsp;&nbsp;&nbsp;
35
 					<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> 
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
 					<br><br>
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
                     <br><br>
32
                     <br><br>
39
 
33
 
40
 				</p>
34
 				</p>

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

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

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

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

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

1
 <!DOCTYPE html>
1
 <!DOCTYPE html>
2
 <html>
2
 <html>
3
 <head>
3
 <head>
4
-    <title>${I18nUtil.getString("admin_name")}</title>
5
   	<#import "/common/common.macro.ftl" as netCommon>
4
   	<#import "/common/common.macro.ftl" as netCommon>
6
 	<@netCommon.commonStyle />
5
 	<@netCommon.commonStyle />
7
 	<!-- DataTables -->
6
 	<!-- DataTables -->
8
   	<link rel="stylesheet" href="${request.contextPath}/static/adminlte/plugins/datatables/dataTables.bootstrap.css">
7
   	<link rel="stylesheet" href="${request.contextPath}/static/adminlte/plugins/datatables/dataTables.bootstrap.css">
9
-
8
+    <title>${I18n.admin_name}</title>
10
 </head>
9
 </head>
11
 <body class="hold-transition skin-blue sidebar-mini <#if cookieMap?exists && "off" == cookieMap["xxljob_adminlte_settings"].value >sidebar-collapse</#if>">
10
 <body class="hold-transition skin-blue sidebar-mini <#if cookieMap?exists && "off" == cookieMap["xxljob_adminlte_settings"].value >sidebar-collapse</#if>">
12
 <div class="wrapper">
11
 <div class="wrapper">
19
 	<div class="content-wrapper">
18
 	<div class="content-wrapper">
20
 		<!-- Content Header (Page header) -->
19
 		<!-- Content Header (Page header) -->
21
 		<section class="content-header">
20
 		<section class="content-header">
22
-			<h1>${I18nUtil.getString("jobinfo_name")}</h1>
21
+			<h1>${I18n.jobinfo_name}</h1>
23
 			<!--
22
 			<!--
24
 			<ol class="breadcrumb">
23
 			<ol class="breadcrumb">
25
 				<li><a><i class="fa fa-dashboard"></i>调度管理</a></li>
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
 <!DOCTYPE html>
1
 <!DOCTYPE html>
2
 <html>
2
 <html>
3
 <head>
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
 </head>
7
 </head>
8
 <body class="hold-transition skin-blue layout-top-nav">
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
 <!DOCTYPE html>
1
 <!DOCTYPE html>
2
 <html>
2
 <html>
3
 <head>
3
 <head>
4
-    <title>${I18nUtil.getString("admin_name")}</title>
5
   	<#import "/common/common.macro.ftl" as netCommon>
4
   	<#import "/common/common.macro.ftl" as netCommon>
6
 	<@netCommon.commonStyle />
5
 	<@netCommon.commonStyle />
7
 	<!-- DataTables -->
6
 	<!-- DataTables -->
8
   	<link rel="stylesheet" href="${request.contextPath}/static/adminlte/plugins/datatables/dataTables.bootstrap.css">
7
   	<link rel="stylesheet" href="${request.contextPath}/static/adminlte/plugins/datatables/dataTables.bootstrap.css">
9
   	<!-- daterangepicker -->
8
   	<!-- daterangepicker -->
10
   	<link rel="stylesheet" href="${request.contextPath}/static/adminlte/plugins/daterangepicker/daterangepicker.css">
9
   	<link rel="stylesheet" href="${request.contextPath}/static/adminlte/plugins/daterangepicker/daterangepicker.css">
10
+    <title>${I18n.admin_name}</title>
11
 </head>
11
 </head>
12
 <body class="hold-transition skin-blue sidebar-mini <#if cookieMap?exists && "off" == cookieMap["xxljob_adminlte_settings"].value >sidebar-collapse</#if> ">
12
 <body class="hold-transition skin-blue sidebar-mini <#if cookieMap?exists && "off" == cookieMap["xxljob_adminlte_settings"].value >sidebar-collapse</#if> ">
13
 <div class="wrapper">
13
 <div class="wrapper">
20
 	<div class="content-wrapper">
20
 	<div class="content-wrapper">
21
 		<!-- Content Header (Page header) -->
21
 		<!-- Content Header (Page header) -->
22
 		<section class="content-header">
22
 		<section class="content-header">
23
-			<h1>${I18nUtil.getString("joblog_name")}</h1>
23
+			<h1>${I18n.joblog_name}</h1>
24
 			<!--
24
 			<!--
25
 			<ol class="breadcrumb">
25
 			<ol class="breadcrumb">
26
 				<li><a><i class="fa fa-dashboard"></i>调度日志</a></li>
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
 <!DOCTYPE html>
1
 <!DOCTYPE html>
2
 <html>
2
 <html>
3
 <head>
3
 <head>
4
-  	<title>${I18nUtil.getString("admin_name")}</title>
5
   	<#import "/common/common.macro.ftl" as netCommon>
4
   	<#import "/common/common.macro.ftl" as netCommon>
6
 	<@netCommon.commonStyle />
5
 	<@netCommon.commonStyle />
7
     <link rel="stylesheet" href="${request.contextPath}/static/adminlte/plugins/iCheck/square/blue.css">
6
     <link rel="stylesheet" href="${request.contextPath}/static/adminlte/plugins/iCheck/square/blue.css">
7
+	<title>${I18n.admin_name}</title>
8
 </head>
8
 </head>
9
 <body class="hold-transition login-page">
9
 <body class="hold-transition login-page">
10
 	<div class="login-box">
10
 	<div class="login-box">
13
 		</div>
13
 		</div>
14
 		<form id="loginForm" method="post" >
14
 		<form id="loginForm" method="post" >
15
 			<div class="login-box-body">
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
 				<div class="form-group has-feedback">
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
 	            	<span class="glyphicon glyphicon-envelope form-control-feedback"></span>
19
 	            	<span class="glyphicon glyphicon-envelope form-control-feedback"></span>
20
 				</div>
20
 				</div>
21
 	          	<div class="form-group has-feedback">
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
 	            	<span class="glyphicon glyphicon-lock form-control-feedback"></span>
23
 	            	<span class="glyphicon glyphicon-lock form-control-feedback"></span>
24
 	          	</div>
24
 	          	</div>
25
 				<div class="row">
25
 				<div class="row">
26
 					<div class="col-xs-8">
26
 					<div class="col-xs-8">
27
 		              	<div class="checkbox icheck">
27
 		              	<div class="checkbox icheck">
28
 		                	<label>
28
 		                	<label>
29
-		                  		<input type="checkbox" name="ifRemember" > ${I18nUtil.getString("login_remember_me")}
29
+		                  		<input type="checkbox" name="ifRemember" >${I18n.login_remember_me}
30
 		                	</label>
30
 		                	</label>
31
 						</div>
31
 						</div>
32
 		            </div><!-- /.col -->
32
 		            </div><!-- /.col -->
33
 		            <div class="col-xs-4">
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
 					</div>
35
 					</div>
36
 				</div>
36
 				</div>
37
 			</div>
37
 			</div>
38
 		</form>
38
 		</form>
39
 	</div>
39
 	</div>
40
 <@netCommon.commonScript />
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
 <script src="${request.contextPath}/static/plugins/jquery/jquery.validate.min.js"></script>
41
 <script src="${request.contextPath}/static/plugins/jquery/jquery.validate.min.js"></script>
55
 <script src="${request.contextPath}/static/adminlte/plugins/iCheck/icheck.min.js"></script>
42
 <script src="${request.contextPath}/static/adminlte/plugins/iCheck/icheck.min.js"></script>
56
 <script src="${request.contextPath}/static/js/login.1.js"></script>
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
 
2
 
3
 	// logout
3
 	// logout
4
 	$("#logoutBtn").click(function(){
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
 			layer.close(index);
6
 			layer.close(index);
7
 
7
 
8
 			$.post(base_url + "/logout", function(data, status) {
8
 			$.post(base_url + "/logout", function(data, status) {
9
 				if (data.code == "200") {
9
 				if (data.code == "200") {
10
-                    layer.msg(logout_success);
10
+                    layer.msg( I18n.logout_success );
11
                     setTimeout(function(){
11
                     setTimeout(function(){
12
                         window.location.href = base_url + "/";
12
                         window.location.href = base_url + "/";
13
                     }, 500);
13
                     }, 500);
14
 					/*layer.open({
14
 					/*layer.open({
15
-						title: '系统提示',
16
-						content: '注销成功',
15
+						title: I18n.system_tips ,
16
+						content: I18n.logout_success ,
17
 						icon: '1',
17
 						icon: '1',
18
 						end: function(layero, index){
18
 						end: function(layero, index){
19
 							window.location.href = base_url + "/";
19
 							window.location.href = base_url + "/";
21
 					});*/
21
 					});*/
22
 				} else {
22
 				} else {
23
 					layer.open({
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
 						icon: '2'
27
 						icon: '2'
28
 					});
28
 					});
29
 				}
29
 				}
74
 		}, 100);
74
 		}, 100);
75
 	});
75
 	});
76
 
76
 
77
-	// 左侧菜单状态,js + 后端 + cookie方式(新)
77
+	// left menu status v: js + server + cookie
78
 	$('.sidebar-toggle').click(function(){
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
 		if ('off' == xxljob_adminlte_settings) {
80
 		if ('off' == xxljob_adminlte_settings) {
81
             xxljob_adminlte_settings = 'on';
81
             xxljob_adminlte_settings = 'on';
82
 		} else {
82
 		} else {
84
 		}
84
 		}
85
 		$.cookie('xxljob_adminlte_settings', xxljob_adminlte_settings, { expires: 7 });	//$.cookie('the_cookie', '', { expires: -1 });
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
 	 var xxljob_adminlte_settings = $.cookie('xxljob_adminlte_settings');
90
 	 var xxljob_adminlte_settings = $.cookie('xxljob_adminlte_settings');
90
 	 if (xxljob_adminlte_settings == 'off') {
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
                     pieChartInit(data);
63
                     pieChartInit(data);
64
                 } else {
64
                 } else {
65
                     layer.open({
65
                     layer.open({
66
-                        title: system_tips,
66
+                        title: I18n.system_tips ,
67
                         content: (data.msg || '调度报表数据加载异常'),
67
                         content: (data.msg || '调度报表数据加载异常'),
68
                         icon: '2'
68
                         icon: '2'
69
                     });
69
                     });

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

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

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

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
+}