forked from jmoenig/Snap
-
Notifications
You must be signed in to change notification settings - Fork 1
/
locale.js
294 lines (250 loc) · 6.95 KB
/
locale.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
/*
locale.js
spoken language translation for SNAP!
written by Jens Mönig
Copyright (C) 2013 by Jens Mönig
This file is part of Snap!.
Snap! is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as
published by the Free Software Foundation, either version 3 of
the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
Attention Translators!
----------------------
Please refer to the documentation in the file
lang-de.js
or to the separate file
translating Snap.txt
(same contents) if you would like to contribute.
*/
// Global settings /////////////////////////////////////////////////////
/*global modules, contains*/
modules.locale = '2013-May-14';
// Global stuff
var Localizer;
var SnapTranslator = new Localizer();
function localize(string) {
return SnapTranslator.translate(string);
}
// Localizer /////////////////////////////////////////////////////////////
function Localizer(language, dict) {
this.language = language || 'en';
this.dict = dict || {};
}
Localizer.prototype.translate = function (string) {
return Object.prototype.hasOwnProperty.call(
this.dict[this.language],
string
) ? this.dict[this.language][string] : string;
};
Localizer.prototype.languages = function () {
var property, arr = [];
for (property in this.dict) {
if (Object.prototype.hasOwnProperty.call(this.dict, property)) {
arr.push(property);
}
}
return arr.sort();
};
Localizer.prototype.languageName = function (lang) {
return this.dict[lang].language_name || lang;
};
Localizer.prototype.credits = function () {
var txt = '',
myself = this;
this.languages().forEach(function (lang) {
txt = txt + '\n'
+ myself.languageName(lang)
+ ' (' + lang + ') - '
+ myself.dict[lang].language_translator
+ ' - ' + myself.dict[lang].last_changed;
});
return txt;
};
Localizer.prototype.unload = function () {
var dict,
keep = ['language_name', 'language_translator', 'last_changed'],
myself = this;
this.languages().forEach(function (lang) {
var key;
if (lang !== 'en') {
dict = myself.dict[lang];
for (key in dict) {
if (Object.prototype.hasOwnProperty.call(dict, key)
&& !contains(keep, key)) {
delete dict[key];
}
}
}
});
};
// SnapTranslator initialization
SnapTranslator.dict.en = {
// meta information
'language_name':
'English',
'language_translator':
'Jens M\u00F6nig',
'translator_e-mail':
'last_changed':
'2012-10-16',
// long strings look-up only
'file menu import hint':
'load an exported project file\nor block library, a costume\n'
+ 'or a sound',
'settings menu prefer empty slots hint':
'check to focus on empty slots\nwhen dragging & '
+ 'dropping reporters',
'costumes tab help':
'import a picture from another web page or from\n'
+ 'a file on your computer by dropping it here\n',
'block deletion dialog text':
'Are you sure you want to delete this\n'
+ 'custom block and all its instances?'
};
SnapTranslator.dict.de = {
// meta information
'language_name':
'Deutsch',
'language_translator':
'Jens M\u00F6nig',
'translator_e-mail':
'last_changed':
'2013-05-14'
};
SnapTranslator.dict.it = {
// meta information
'language_name':
'Italiano',
'language_translator':
'Stefano Federici',
'translator_e-mail':
'last_changed':
'2013-04-08'
};
SnapTranslator.dict.ja = {
// meta information
'language_name':
'日本語',
'language_translator':
'Kazuhiro Abe',
'translator_e-mail':
'last_changed':
'2012-04-02'
};
SnapTranslator.dict.ja_HIRA = {
// meta information
'language_name':
'にほんご',
'language_translator':
'Kazuhiro Abe',
'translator_e-mail':
'last_changed':
'2012-04-02'
};
SnapTranslator.dict.ko = {
// meta information
'language_name':
'한국어',
'language_translator':
'Yunjae Jang',
'translator_e-mail':
'last_changed':
'2012-11-18'
};
SnapTranslator.dict.pt = {
// meta information
'language_name':
'Português',
'language_translator':
'Manuel Menezes de Sequeira',
'translator_e-mail':
'last_changed':
'2013-04-08'
};
SnapTranslator.dict.cs = {
// meta information
'language_name':
'Česky',
'language_translator':
'Michal Moc',
'translator_e-mail':
'last_changed':
'2013-03-11'
};
SnapTranslator.dict.zh = {
// translations meta information
'language_name':
'简体中文',
'language_translator':
'邓江华',
'translator_e-mail':
'last_changed':
'2013-03-25'
};
SnapTranslator.dict.eo = {
// translations meta information
'language_name':
'Esperanto',
'language_translator':
'Sebastian Cyprych',
'translator_e-mail':
'scy(ĉe)epf.pl',
'last_changed':
'2012-11-11'
};
SnapTranslator.dict.fr = {
// translations meta information
'language_name':
'Fran\u00E7ais',
'language_translator':
'Jean-Jacques Valliet - Mark Rafter',
'translator_e-mail':
'last_changed':
'2012-11-27'
};
SnapTranslator.dict.si = {
'language_name':
'Sloven\u0161\u010Dina',
'language_translator':
'Sasa Divjak',
'translator_e-mail':
'last_changed':
'2013-01-07'
};
SnapTranslator.dict.ru = {
'language_name':
'Русский',
'language_translator':
'Svetlana Ptashnaya',
'translator_e-mail':
'last_changed':
'2013-03-19'
};
SnapTranslator.dict.es = {
'language_name':
'Espa\u00F1ol',
'language_translator':
'V\u00EDctor Manuel Muratalla Morales',
'translator_e-mail':
'last_changed':
'2013-03-25'
};