Skip to content

Commit d966a16

Browse files
committed
add multi-language support for app
1 parent fc40d22 commit d966a16

File tree

9 files changed

+81
-16
lines changed

9 files changed

+81
-16
lines changed

Makefile

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ source_dir=$(build_dir)/source
77
sign_dir=$(build_dir)/sign
88
package_name=$(app_name)
99
cert_dir=$(CURDIR)/../../key
10-
version+=0.0.5
10+
version+=0.0.6
1111

1212
all: appstore
1313

appinfo/info.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<name>Mind Map</name>
66
<summary>A Mind map editor</summary>
77
<description><![CDATA[This application enables Nextcloud users to open, save and edit mind map files in the web browser. If enabled, an entry in the New button at the top of the web browser the Mindmap file entry appears. When clicked, a new mindmap file opens in the browser and the file can be saved into the current Nextcloud directory.]]></description>
8-
<version>0.0.5</version>
8+
<version>0.0.6</version>
99
<licence>agpl</licence>
1010
<author mail="[email protected]" homepage="https://actom.me">Jingtao Yan</author>
1111
<namespace>Files_MindMap</namespace>

js/mindmap.js

+4-4
Original file line numberDiff line numberDiff line change
@@ -96,10 +96,10 @@ var FilesMindMap = {
9696
}
9797
})
9898
.done(function(){
99-
success('内容已保存')
99+
success(t('files_mindmap', 'File Saved'))
100100
self._changed = false;
101101
}).fail(function(jqXHR){
102-
var message = '保存失败';
102+
var message = t('files_mindmap', 'Save failed');
103103
try{
104104
message = JSON.parse(jqXHR.responseText).message;
105105
}catch(e){
@@ -184,8 +184,8 @@ FilesMindMap.NewFileMenuPlugin = {
184184
// register the new menu entry
185185
menu.addMenuEntry({
186186
id: 'mindmapfile',
187-
displayName: '新建思维导图文件',
188-
templateName: '新建思维导图.km',
187+
displayName: t('files_mindmap', 'New mind map file'),
188+
templateName: t('files_mindmap', 'New mind map.km'),
189189
iconClass: 'icon-link',
190190
fileType: 'mindmap',
191191
actionHandler: function(name) {

js/viewer.js

+8-4
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,10 @@ function redirectIfNotDisplayedInFrame () {
1313
redirectIfNotDisplayedInFrame();
1414

1515
(function() {
16+
var t = function(msg) {
17+
return window.parent.t('files_mindmap', msg);
18+
};
19+
1620
var MindMap = {
1721
_changed: false,
1822
_saveTimer: null,
@@ -88,7 +92,7 @@ redirectIfNotDisplayedInFrame();
8892
save: function() {
8993
var self = this;
9094
if (self._changed) {
91-
self.setStatusMessage('正在保存...');
95+
self.setStatusMessage(t('Saving...'));
9296
var data = JSON.stringify(minder.exportJson());
9397
window.parent.OCA.FilesMindMap.save(data, function(msg){
9498
self.setStatusMessage(msg);
@@ -104,7 +108,7 @@ redirectIfNotDisplayedInFrame();
104108
{"data":
105109
{"id":"bopmq"+String(Math.floor(Math.random() * 9e15)).substr(0, 7),
106110
"created":(new Date()).getTime(),
107-
"text":"中心主题"
111+
"text":t('Main Topic')
108112
},
109113
"children":[]
110114
},
@@ -118,15 +122,15 @@ redirectIfNotDisplayedInFrame();
118122
try {
119123
obj = JSON.parse(data);
120124
} catch (e){
121-
alert('此文件不是有效的思维导图文件,如果继续编辑可能导致文件损坏!');
125+
alert(t('This file is not a valid mind map file and may cause file corruption if you continue editing.'));
122126
}
123127
}
124128
minder.importJson(obj);
125129
self._loadStatus = true;
126130
self._changed = false;
127131
}, function(msg){
128132
self._loadStatus = false;
129-
alert('载入文件失败!' + msg);
133+
alert(t('Load file fail!') + msg);
130134
window.parent.OCA.FilesMindMap.hide();
131135
});
132136
},

l10n/de.js

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
OC.L10N.register(
2+
"files_mindmap",
3+
{
4+
"New mind map file": "Neue Mindmap-Datei",
5+
"New mind map.km": "Neue Mindmap.km",
6+
"Main Topic": "Zentrales Thema",
7+
"Saving...": "Speichern ...",
8+
"This file is not a valid mind map file and may cause file corruption if you continue editing.": "Diese Datei ist keine gültige Mind Map-Datei und kann zu Dateibeschädigungen führen, wenn Sie mit der Bearbeitung fortfahren.",
9+
"Load file fail!": "Datei laden fehlgeschlagen!",
10+
"File Saved": "Datei gespeichert",
11+
"Save failed": "Speichern fehlgeschlagen",
12+
"Export": "Export",
13+
"Export to PNG": "Export nach PNG",
14+
"Export to SVG": "Export nach SVG"
15+
},"nplurals=1; plural=0;"
16+
);

l10n/de.json

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
{
2+
"translations": {
3+
"New mind map file": "Neue Mindmap-Datei",
4+
"New mind map.km": "Neue Mindmap.km",
5+
"Main Topic": "Zentrales Thema",
6+
"Saving...": "Speichern ...",
7+
"This file is not a valid mind map file and may cause file corruption if you continue editing.": "Diese Datei ist keine gültige Mind Map-Datei und kann zu Dateibeschädigungen führen, wenn Sie mit der Bearbeitung fortfahren.",
8+
"Load file fail!": "Datei laden fehlgeschlagen!",
9+
"File Saved": "Datei gespeichert",
10+
"Save failed": "Speichern fehlgeschlagen",
11+
"Export": "Export",
12+
"Export to PNG": "Export nach PNG",
13+
"Export to SVG": "Export nach SVG"
14+
},"pluralForm" :"nplurals=1; plural=0;"
15+
}

l10n/zh_CN.js

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
OC.L10N.register(
2+
"files_mindmap",
3+
{
4+
"New mind map file": "新建思维导图文件",
5+
"New mind map.km": "新建思维导图.km",
6+
"Main Topic": "中心主题",
7+
"Saving...": "正在保存...",
8+
"This file is not a valid mind map file and may cause file corruption if you continue editing.": "此文件不是有效的思维导图文件,如果继续编辑可能导致文件损坏!",
9+
"Load file fail!": "载入文件失败!",
10+
"File Saved": "内容已保存",
11+
"Save failed": "保存失败",
12+
"Export": "导出",
13+
"Export to PNG": "导出为PNG图像",
14+
"Export to SVG": "导出为SVG图像"
15+
},"nplurals=1; plural=0;"
16+
);

l10n/zh_CN.json

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
{
2+
"translations": {
3+
"New mind map file": "新建思维导图文件",
4+
"New mind map.km": "新建思维导图.km",
5+
"Main Topic": "中心主题",
6+
"Saving...": "正在保存...",
7+
"This file is not a valid mind map file and may cause file corruption if you continue editing.": "此文件不是有效的思维导图文件,如果继续编辑可能导致文件损坏!",
8+
"Load file fail!": "载入文件失败!",
9+
"File Saved": "内容已保存",
10+
"Save failed": "保存失败",
11+
"Export": "导出",
12+
"Export to PNG": "导出为PNG图像",
13+
"Export to SVG": "导出为SVG图像"
14+
},"pluralForm" :"nplurals=1; plural=0;"
15+
}

templates/viewer.php

+5-6
Original file line numberDiff line numberDiff line change
@@ -108,18 +108,18 @@
108108
<div id="export-button" class="btn-group-vertical" dropdown is-open="isopen">
109109
<button type="button"
110110
class="btn btn-default export-caption dropdown-toggle"
111-
title="{{ 'export' | lang:'ui' }}"
111+
title="<?php p($l->t('Export')); ?>"
112112
dropdown-toggle>
113-
<span class="caption">{{ 'export' | lang:'ui' }}</span>
113+
<span class="caption"><?php p($l->t('Export')); ?></span>
114114
<span class="caret"></span>
115-
<span class="sr-only">{{ 'export' | lang:'ui' }}</span>
115+
<span class="sr-only"><?php p($l->t('Export')); ?></span>
116116
</button>
117117
<ul class="dropdown-menu" role="menu">
118118
<li>
119-
<a id="export-png" href">{{ 'exportPNG' | lang:'ui/command' }}</a>
119+
<a id="export-png" href"><?php p($l->t('Export to PNG')); ?></a>
120120
</li>
121121
<li>
122-
<a id="export-svg" href">{{ 'exportSVG' | lang:'ui/command' }}</a>
122+
<a id="export-svg" href"><?php p($l->t('Export to SVG')); ?></a>
123123
</li>
124124
</ul>
125125
</div>
@@ -142,7 +142,6 @@ class="btn btn-default export-caption dropdown-toggle"
142142
<script nonce="<?php p(\OC::$server->getContentSecurityPolicyNonceManager()->getNonce()) ?>" src="<?php p($urlGenerator->linkTo('files_mindmap', 'vendor/marked/lib/marked.js')) ?>?v=<?php p($version) ?>"></script>
143143
<script nonce="<?php p(\OC::$server->getContentSecurityPolicyNonceManager()->getNonce()) ?>" src="<?php p($urlGenerator->linkTo('files_mindmap', 'vendor/kity/dist/kity.min.js')) ?>?v=<?php p($version) ?>"></script>
144144
<script nonce="<?php p(\OC::$server->getContentSecurityPolicyNonceManager()->getNonce()) ?>" src="<?php p($urlGenerator->linkTo('files_mindmap', 'vendor/hotbox/hotbox.js')) ?>?v=<?php p($version) ?>"></script>
145-
<script nonce="<?php p(\OC::$server->getContentSecurityPolicyNonceManager()->getNonce()) ?>" src="<?php p($urlGenerator->linkTo('files_mindmap', 'vendor/json-diff/json-diff.js')) ?>?v=<?php p($version) ?>"></script>
146145
<script nonce="<?php p(\OC::$server->getContentSecurityPolicyNonceManager()->getNonce()) ?>" src="<?php p($urlGenerator->linkTo('files_mindmap', 'vendor/kityminder-core/dist/kityminder.core.min.js')) ?>?v=<?php p($version) ?>"></script>
147146
<script nonce="<?php p(\OC::$server->getContentSecurityPolicyNonceManager()->getNonce()) ?>" src="<?php p($urlGenerator->linkTo('files_mindmap', 'vendor/color-picker/dist/color-picker.min.js')) ?>?v=<?php p($version) ?>"></script>
148147
<script nonce="<?php p(\OC::$server->getContentSecurityPolicyNonceManager()->getNonce()) ?>" src="<?php p($urlGenerator->linkTo('files_mindmap', 'vendor/js-base64/base64.min.js')) ?>?v=<?php p($version) ?>"></script>

0 commit comments

Comments
 (0)