Skip to content

Commit b9a88f5

Browse files
committed
在线编辑页面国际化
1 parent ee072b1 commit b9a88f5

File tree

10 files changed

+38
-15
lines changed

10 files changed

+38
-15
lines changed

examples/3dwebgl/editor.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<html>
33
<head>
44
<meta charset="UTF-8">
5-
<title>SuperMap 3D-WebGL 示例代码</title>
5+
<title>SuperMap 3D-WebGL example editor</title>
66
<link rel="shortcut icon" type="image/x-icon" href="../../web/img/favicon.ico"/>
77
<meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" name="viewport">
88
<script type="text/javascript" exclude="example-i18n" include="jquery,bootstrap,template,admin-lte,ace,i18n"

examples/classic/editor.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<html>
33
<head>
44
<meta charset="UTF-8">
5-
<title>iClient Classic 示例代码</title>
5+
<title>iClient Classic example editor</title>
66
<link rel="shortcut icon" type="image/x-icon" href="../../web/img/favicon.ico"/>
77
<meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" name="viewport">
88
<script type="text/javascript" exclude="example-i18n" include="jquery,bootstrap,template,admin-lte,ace,i18n"

examples/css/editor.css

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,8 @@ html, body, .wrapper {
9595
position: absolute;
9696
top: 4px;
9797
right: 0;
98-
width: 54px;
98+
padding: 0 10px;
99+
min-width: 54px;
99100
height: 30px;
100101
line-height: 30px;
101102
margin: 4px;

examples/js/editor.js

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ function initPage() {
1111
initSideBar();
1212
initEditor();
1313
screenResize();
14+
Localization.localize();
1415
}
1516

1617
function initSideBar() {
@@ -67,7 +68,7 @@ function loadExampleHtml() {
6768
url: mapUrl,
6869
async: false,
6970
error: function (error) {
70-
alert("请在服务器环境下运行示范程序!");
71+
alert(resources.editor.envTips);
7172
html = "";
7273
}
7374
}).responseText;
@@ -105,9 +106,15 @@ function loadPreview(content) {
105106
iframeDocument.open();
106107
iframeDocument.write(content);
107108
iframeDocument.close();
108-
iframeDocument.addEventListener('load', function () {
109+
var doc = document;
110+
iFrame.addEventListener('load', function () {
109111
mapHeight();
112+
setTimeout(function () {
113+
doc.title = iframeDocument.title;
114+
}, 100);
115+
110116
});
117+
111118
mapHeight();
112119
}
113120

@@ -168,7 +175,7 @@ function bindEvents() {
168175
$("#showCodeBtn").click(function () {
169176
if (expand) {
170177
//编辑器和预览宽度5:7
171-
$(this).text(" 展开");
178+
$(this).text(resources.editor.expand);
172179
$(this).addClass("fa-arrows-alt");
173180
$(this).removeClass(" fa-compress");
174181
codePane.show(10, function () {
@@ -178,7 +185,7 @@ function bindEvents() {
178185
});
179186
} else {
180187
//预览独占一行
181-
$(this).text(" 源码");
188+
$(this).text(resources.editor.source);
182189
$(this).addClass(" fa-compress");
183190
$(this).removeClass("fa-arrows-alt");
184191
codePane.hide(200, function () {

examples/leaflet/editor.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<html>
33
<head>
44
<meta charset="UTF-8">
5-
<title>iClient for Leaflet 示例代码</title>
5+
<title>iClient for Leaflet example editor</title>
66
<link rel="shortcut icon" type="image/x-icon" href="../../web/img/favicon.ico"/>
77
<meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" name="viewport">
88
<script type="text/javascript" exclude="example-i18n" include="jquery,bootstrap,template,admin-lte,ace,i18n"

examples/locales/en-US/resources.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,14 @@ window.resources = {
121121
"join_tips2": " and attach your resume)",
122122
"copyright": "Copyright © 2000-2018 SuperMap Software Co., Ltd. All rights reserved"
123123
},
124+
"editor":{
125+
"expand":" Expand",
126+
"source":" Source",
127+
"title":"Source Code Editor",
128+
"run":" Run",
129+
"reset":" Reset",
130+
"envTips":"Please run the program in server environment!"
131+
},
124132
"resources": {
125133
"title_tiledMapLayer4326": "base map of SuperMap REST map",
126134
"title_tiledMapLayer3857": "base map of SuperMap REST map",

examples/locales/zh-CN/resources.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,14 @@ window.resources = {
121121
"join_tips2": ",附上您的简历哦)",
122122
"copyright": "版权所有 © 2000-2018 北京超图软件股份有限公司 京ICP备11032883号-8 京公网安备11010502008721 甲测资字11002074"
123123
},
124+
"editor":{
125+
"expand":" 展开",
126+
"source":" 源码",
127+
"title":"源代码编辑器",
128+
"run":" 运行",
129+
"reset":" 重置",
130+
"envTips":"请在服务器环境下运行示范程序!"
131+
},
124132
"resources": {
125133
"title_tiledMapLayer4326": "SuperMap REST 地图服务底图",
126134
"title_tiledMapLayer3857": "SuperMap REST 地图服务底图",

examples/mapboxgl/editor.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<html>
33
<head>
44
<meta charset="UTF-8">
5-
<title>iClient for MapBoxGL 示例代码</title>
5+
<title>iClient for MapBoxGL example editor</title>
66
<link rel="shortcut icon" type="image/x-icon" href="../../web/img/favicon.ico"/>
77
<meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" name="viewport">
88
<script type="text/javascript" exclude="example-i18n" include="jquery,bootstrap,template,admin-lte,ace,i18n"

examples/openlayers/editor.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<html>
33
<head>
44
<meta charset="UTF-8">
5-
<title>iClient for OpenLayers 示例代码</title>
5+
<title>iClient for OpenLayers example editor</title>
66
<link rel="shortcut icon" type="image/x-icon" href="../../web/img/favicon.ico"/>
77
<meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" name="viewport">
88
<script type="text/javascript" exclude="example-i18n" include="jquery,bootstrap,template,admin-lte,ace,i18n"

examples/template/editor.html

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,12 +26,11 @@
2626
<div class="content-wrapper edit-container">
2727

2828
<section class="content">
29-
<span class="fa fa-compress" id="showCodeBtn">&nbsp;源码</span>
29+
<span class="fa fa-compress" id="showCodeBtn" data-i18n="editor.source"></span>
3030
<div class="pane" id="codePane" style="display: none">
31-
<div class="codePaneTool">
32-
源代码编辑器
33-
<div class="fa fa-play-circle-o editorBtn" id="runBtn" onclick="run()">&nbsp;运行</div>
34-
<div class="fa fa-undo editorBtn" id="resetBtn" onclick="refresh()">&nbsp;重置</div>
31+
<div class="codePaneTool"><span data-i18n="editor.title"></span>
32+
<div class="fa fa-play-circle-o editorBtn" id="runBtn" onclick="run()" data-i18n="editor.run"></div>
33+
<div class="fa fa-undo editorBtn" id="resetBtn" onclick="refresh()" data-i18n="editor.reset"></div>
3534
</div>
3635
<div id="editor">
3736

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy