forked from jmoenig/Snap
-
Notifications
You must be signed in to change notification settings - Fork 0
/
locale.js
513 lines (451 loc) · 11.6 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
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
/*
locale.js
spoken language translation for SNAP!
written by Jens Mönig
Copyright (C) 2015 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 = '2015-August-06';
// 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':
'2015-08-06'
};
SnapTranslator.dict.it = {
// meta information
'language_name':
'Italiano',
'language_translator':
'Stefano Federici, Alberto Firpo',
'translator_e-mail':
'last_changed':
'2015-01-12'
};
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':
'2015-01-21'
};
SnapTranslator.dict.pt = {
// meta information
'language_name':
'Português',
'language_translator':
'Manuel Menezes de Sequeira',
'translator_e-mail':
'last_changed':
'2015-08-02'
};
SnapTranslator.dict.cs = {
// meta information
'language_name':
'Česky',
'language_translator':
'Michal Moc',
'translator_e-mail':
'last_changed':
'2013-03-11'
};
SnapTranslator.dict.zh = {
// meta information
'language_name':
'简体中文',
'language_translator':
'邓江华',
'translator_e-mail':
'last_changed':
'2013-03-25'
};
SnapTranslator.dict.eo = {
// meta information
'language_name':
'Esperanto',
'language_translator':
'Sebastian Cyprych',
'translator_e-mail':
'scy(ĉe)epf.pl',
'last_changed':
'2012-11-11'
};
SnapTranslator.dict.fr = {
// meta information
'language_name':
'Fran\u00E7ais',
'language_translator':
'Jean-Jacques Valliet, Mark Rafter, Martin Quinson',
'translator_e-mail':
'last_changed':
'2015-06-25'
};
SnapTranslator.dict.si = {
// meta information
'language_name':
'Sloven\u0161\u010Dina',
'language_translator':
'Sasa Divjak',
'translator_e-mail':
'last_changed':
'2013-01-07'
};
SnapTranslator.dict.ru = {
// meta information
'language_name':
'Русский',
'language_translator':
'Svetlana Ptashnaya',
'translator_e-mail':
'last_changed':
'2014-09-29'
};
SnapTranslator.dict.es = {
// meta information
'language_name':
'Espa\u00F1ol',
'language_translator':
'V\u00EDctor Manuel Muratalla Morales',
'translator_e-mail':
'last_changed':
'2013-03-25'
};
SnapTranslator.dict.nl = {
// meta information
'language_name':
'Nederlands',
'language_translator':
'Frank Sierens, Sjoerd Dirk Meijer',
'translator_e-mail':
'last_changed':
'2013-08-12'
};
SnapTranslator.dict.pl = {
// meta information
'language_name':
'Polski',
'language_translator':
'Witek Kranas',
'translator_e-mail':
'last_changed':
'2015-08-06'
};
SnapTranslator.dict.tw = {
// meta information
'language_name':
'繁體中文',
'language_translator':
'cch',
'translator_e-mail':
'last_changed':
'2013-8-14'
};
SnapTranslator.dict.no = {
// meta information
'language_name':
'Norsk',
'language_translator':
'Olav A Marschall',
'translator_e-mail':
'last_changed':
'2013-09-16'
};
SnapTranslator.dict.dk = {
// meta information
'language_name':
'Dansk',
'language_translator':
'FAB',
'translator_e-mail':
'last_changed':
'2013-09-16'
};
SnapTranslator.dict.el = {
// meta information
'language_name':
'Ελληνικά',
'language_translator':
'Ino Samaras',
'translator_e-mail':
'last_changed':
'2013-09-16'
};
SnapTranslator.dict.ca = {
// meta information
'language_name':
'Català',
'language_translator':
'Bernat Romagosa Carrasquer',
'translator_e-mail':
'last_changed':
'2015-01-21'
};
SnapTranslator.dict.fi = {
// meta information
'language_name':
'suomi',
'language_translator':
'Jouni K. Sepp\u00e4nen',
'translator_e-mail':
'last_changed':
'2014-04-18'
};
SnapTranslator.dict.sv = {
// meta information
'language_name':
'svenska',
'language_translator':
'Erik A. Olsson',
'translator_e-mail':
'last_changed':
'2014-12-14'
};
SnapTranslator.dict.pt_BR = {
// meta information
'language_name':
'Português do Brasil',
'language_translator':
'Aldo von Wangenheim',
'translator_e-mail':
'last_changed':
'2014-04-20'
};
SnapTranslator.dict.bn = {
// meta information
'language_name':
'বাংলা',
'language_translator':
'Dr. Mokter Hossain',
'translator_e-mail':
'last_changed':
'2014-07-02'
};
SnapTranslator.dict.kn = {
// translations meta information
'language_name':
'\u0C95\u0CA8\u0CCD\u0CA8\u0CA1',
'language_translator':
'Vinayakumar R',
'translator_e-mail':
'last_changed':
'2014-12-02'
};
SnapTranslator.dict.ml = {
// translations meta information
'language_name':
'Malayalam',
'language_translator':
'vinayakumar R',
'translator_e-mail':
'last_changed':
'2015-02-20'
};
SnapTranslator.dict.ta = {
// translations meta information
'language_name':
'Tamil',
'language_translator':
'vinayakumar R',
'translator_e-mail':
'last_changed':
'2015-02-20'
};
SnapTranslator.dict.te = {
// translations meta information
'language_name':
'Telagu', // the name as it should appear in the language menu
'language_translator':
'vinayakumar R', // your name for the Translators tab
'translator_e-mail':
'[email protected]', // optional
'last_changed':
'2015-02-20'
};
SnapTranslator.dict.tr = {
// translations meta information
'language_name':
'Türkçe',
'language_translator':
'Hakan Atas',
'translator_e-mail':
'last_changed':
'2015-7-27'
};
SnapTranslator.dict.hu = {
// translations meta information
'language_name':
'Magyar',
'language_translator':
'Makány György',
'translator_e-mail':
'last_changed':
'2015-07-27'
};
SnapTranslator.dict.ia = {
// translations meta information
'language_name':
'Interlingua',
'language_translator':
'Ken Dickey',
'translator_e-mail':
'last_changed':
'2015-08-09'
};