iobroker.vis-icontwo 1.18.1 → 1.18.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,4 +1,4 @@
1
- ![Logo](admin/icontwo.png)
1
+ ![Logo](admin/icontwo.png)
2
2
  # ioBroker.vis-icontwo
3
3
 
4
4
  ![Number of Installations (latest)](http://iobroker.live/badges/vis-icontwo-installed.svg)
@@ -60,8 +60,11 @@ Falls Dir unsere Arbeit gefällt und Du uns unterstützen möchtest, wir freuen
60
60
  <!--
61
61
  ### **WORK IN PROGRESS**
62
62
  -->
63
- ### **WORK IN PROGRESS**
64
- - (skvarel) Added: Changelog_old
63
+ ### 1.18.6 (2026-01-31)
64
+ - (skvarel) Bugfix
65
+
66
+ ### 1.18.5 (2026-01-31)
67
+ - (skvarel) Release-Test: Version und News-Sync
65
68
 
66
69
  ### 1.18.0
67
70
 
@@ -80,576 +83,6 @@ Falls Dir unsere Arbeit gefällt und Du uns unterstützen möchtest, wir freuen
80
83
 
81
84
  • Neue Icons hinzugefügt (Devices/mower)
82
85
 
83
- ### 1.14.0
84
-
85
- • Neue Icons hinzugefügt (Player/record)
86
-
87
- ### 1.13.0
88
-
89
- • Neue Icons hinzugefügt (Alarm/record)
90
-
91
- ### 1.12.0
92
-
93
- • Neue Icons hinzugefügt (Animals/Cats)
94
-
95
- ### 1.11.0
96
-
97
- • Neue Icons hinzugefügt (Cars)
98
-
99
- ### 1.10.2
100
-
101
- • Bug-Fix
102
-
103
- ### 1.10.1
104
-
105
- • Bug-Fix
106
-
107
- ### 1.10.0
108
-
109
- • Neue Icons hinzugefügt (Devices - Computers - Zigbee)
110
-
111
- ### 1.9.0
112
-
113
- • Neue Icons hinzugefügt (Brands - Zigbee)
114
-
115
- ### 1.8.1
116
-
117
- • Bug-Fix
118
-
119
- ### 1.8.0
120
-
121
- • Neue Icons hinzugefügt (Devices - Network)
122
-
123
- ### 1.6.3
124
-
125
- • Bug-Fix
126
-
127
- ### 1.6.0
128
-
129
- • Neue Icons hinzugefügt (Devices - Mower Blade)
130
-
131
- ### 1.5.0
132
-
133
- • Neue Icons hinzugefügt (Animals - Rat & Mouse)
134
-
135
- ### 1.4.0
136
-
137
- • Neue Icons hinzugefügt (Lights - Printer-LED)
138
-
139
- ### 1.3.0
140
-
141
- • Neue Icons hinzugefügt (Lights - LED)
142
-
143
- ### 1.2.1
144
-
145
- • Bugfix (version number)
146
-
147
- ### 1.2.0
148
-
149
- • Neue Icons hinzugefügt (Devices - thermal_heater) (Devices/Printers - printer_lable)
150
-
151
- ### 1.1.0
152
-
153
- • Neue Icons hinzugefügt (Devices - printer AMS) (Games - scissors/stone/paper)
154
-
155
- ### 1.0.0
156
-
157
- • VIS-2 kompatibel
158
-
159
- ### 0.98.0
160
-
161
- • Neue Icons hinzugefügt (Devices - printer AMS)
162
-
163
- ### 0.97.3
164
-
165
- • Bugfix
166
-
167
- ### 0.97.2
168
-
169
- • Bugfix
170
-
171
- ### 0.97.1
172
-
173
- • Bugfix
174
-
175
- ### 0.97.0
176
-
177
- • Neue Icons hinzugefügt (Devices - printer)
178
-
179
- ### 0.96.0
180
-
181
- • Neue Icons hinzugefügt (Devices - vacuum-cleaner) (Signs - sum)
182
-
183
- ### 0.95.0
184
-
185
- • Neue Icons hinzugefügt (Misc)
186
-
187
- ### 0.94.0
188
-
189
- • Neue Icons hinzugefügt (Brands)
190
-
191
- ### 0.93.0
192
-
193
- • Neue Icons hinzugefügt (Devices/Cooling/)
194
-
195
- ### 0.92.0
196
-
197
- • Neue Icons hinzugefügt (Alarm)
198
-
199
- ### 0.91.0
200
-
201
- • Neue Icons hinzugefügt (Alarm)
202
-
203
- ### 0.90.0
204
-
205
- • Neue Icons hinzugefügt (Devices/Network/hmip)
206
-
207
- ### 0.89.0
208
-
209
- • Neue Icons hinzugefügt (Devices/water)
210
-
211
- ### 0.88.0
212
-
213
- • Neue Icons hinzugefügt (Devices/water)
214
-
215
- ### 0.87.0
216
-
217
- • Neue Icons hinzugefügt (Battery/Percent)
218
-
219
- ### 0.86.2
220
-
221
- • Bugfix
222
-
223
- ### 0.86.1
224
-
225
- • Bugfix (npm Version)
226
-
227
- ### 0.86.0
228
-
229
- • Neue Icons hinzugefügt (Versand)
230
-
231
- ### 0.85.0
232
-
233
- • Neue Icons hinzugefügt (Wetter-Warnung & Navigation & Automobil)
234
-
235
- ### 0.84.0
236
-
237
- • Neue Icons hinzugefügt (Devices)
238
-
239
- ### 0.83.0
240
-
241
- • Neue Icons hinzugefügt (Animals)
242
-
243
- ### 0.82.0
244
-
245
- • Neue Icons hinzugefügt (Elektricity)
246
-
247
- ### 0.81.0
248
-
249
- • Neue Icons hinzugefügt (Animated/Fan & Navigation)
250
-
251
- ### 0.80.0
252
-
253
- • Neue Icons hinzugefügt (Brands/H2Oreader)
254
-
255
- ### 0.79.0
256
-
257
- • Neue Icons hinzugefügt (Devices/Gas- & Watermeter)
258
-
259
- ### 0.78.0
260
-
261
- • Neue Icons hinzugefügt (Spa_Fitness)
262
-
263
- ### 0.77.0
264
-
265
- • Neue Icons hinzugefügt (Spa_Fitness)
266
-
267
- ### 0.76.0
268
-
269
- • Neue Icons hinzugefügt (Devices/thermostat)
270
-
271
- ### 0.75.0
272
-
273
- • Neue Icons hinzugefügt (Hobbies/Train)
274
-
275
- ### 0.74.0
276
-
277
- • Neue Icons hinzugefügt (Letters/Rounded)
278
-
279
- ### 0.73.0
280
-
281
- • Neue Icons hinzugefügt (Hobbies/Train)
282
-
283
- ### 0.72.0
284
-
285
- • Neue Icons hinzugefügt (Hobbies/Train)
286
-
287
- ### 0.71.0
288
-
289
- • Neue Icons hinzugefügt (Devices/Computer)
290
-
291
- ### 0.70.0
292
-
293
- • Neue Icons hinzugefügt (Player/Cover)
294
-
295
- ### 0.69.0
296
-
297
- • Neue Icons hinzugefügt (Hobbies/Train & Spa_Fitness)
298
-
299
- ### 0.68.0
300
-
301
- • Neue Icons hinzugefügt (Devices/Sandfilter)
302
-
303
- ### 0.67.0
304
-
305
- • Neue Icons hinzugefügt (Hobbies)
306
-
307
-
308
- ### 0.66.0
309
-
310
- • Neue Icons hinzugefügt (Clock & Timer)
311
-
312
- ### 0.65.1
313
-
314
- • Bugfix
315
-
316
-
317
- ### 0.65.0
318
-
319
- • Neue Icons hinzugefügt (Player)
320
-
321
- ### 0.64.0
322
-
323
- • Neue Icons hinzugefügt (Brands & Computer)
324
-
325
- ### 0.63.0
326
-
327
- • Neue Icons hinzugefügt (Animated Icons - Arrows, Maps, Phones & Weather)
328
-
329
- ### 0.62.0
330
-
331
- • Neue Icons hinzugefügt (Animated Icons - Charts & Alarm)
332
-
333
- ### 0.61.0
334
-
335
- • Neue Icons hinzugefügt (Finance & Charts)
336
-
337
- ### 0.60.0
338
-
339
- • Neue Icons hinzugefügt (Devices/Printer - 3D Druck Icons)
340
-
341
- ### 0.50.2
342
-
343
- • Bugfix
344
-
345
- ### 0.50.1
346
-
347
- • Code Optimierung und neuer Spenden-Link
348
-
349
- ### 0.50.0
350
-
351
- • Neue Icons hinzugefügt (Gardinen)
352
-
353
- ### 0.49.1
354
-
355
- • Bugfix
356
-
357
- ### 0.49.0
358
-
359
- • Neue Icons hinzugefügt (Brands)
360
-
361
- ### 0.48.0
362
-
363
- • Neue Icons hinzugefügt (Brands & Health)
364
-
365
- ### 0.47.0
366
-
367
- • Neue Icons hinzugefügt (Animated Icons)
368
-
369
- ### 0.46.0
370
-
371
- • Neue Icons hinzugefügt (Devices/Fountain Timer)
372
-
373
- ### 0.45.0
374
-
375
- • Neue Icons hinzugefügt (Devices/Cleaner & Drinks/Wine)
376
-
377
- ### 0.44.0
378
-
379
- • Neue Icons hinzugefügt (Devices/Laser)
380
-
381
- ### 0.43.0
382
-
383
- • Neue Icons hinzugefügt (Backgrounds & Brands)
384
-
385
- ### 0.42.0
386
-
387
- • Neue Icons hinzugefügt (Drinks_Food)
388
-
389
- ### 0.41.0
390
-
391
- • Neue Icons hinzugefügt (Alarm/Motion)
392
-
393
- ### 0.40.0
394
-
395
- • Neue Icons hinzugefügt (Misc/Newspaper)
396
-
397
- ### 0.39.0
398
-
399
- • Neue Icons hinzugefügt (Signs)
400
-
401
- ### 0.38.0
402
-
403
- • Neue Icons hinzugefügt (Electricity)
404
-
405
- ### 0.37.0
406
-
407
- • Neue Icons hinzugefügt (Lights)
408
-
409
- ### 0.36.0
410
-
411
- • Neue Icons hinzugefügt (Computer)
412
-
413
- ### 0.35.0
414
-
415
- • Neue Icons hinzugefügt (Lights)
416
-
417
- ### 0.34.0
418
-
419
- • Neue Icons hinzugefügt (Dimmer)
420
-
421
- ### 0.33.1
422
-
423
- • Bug Fix
424
-
425
- ### 0.33.0
426
-
427
- • Neue Icons hinzugefügt (Maps)
428
-
429
- ### 0.32.0
430
-
431
- • Neue Icons hinzugefügt (Stop)
432
-
433
- ### 0.31.0
434
-
435
- • Neue Icons hinzugefügt (Spa & Fitness, Electricity, Lights, Rooms)
436
-
437
- ### 0.30.1
438
-
439
- • Bug Fix
440
-
441
- ### 0.30.0
442
-
443
- • Neue Icons hinzugefügt (Network, Devices)
444
-
445
- ### 0.29.0
446
-
447
- • Neue Icons hinzugefügt (Electricity)
448
-
449
- ### 0.28.0
450
-
451
- • Neue Icons hinzugefügt (Arrows, Shopping, Electricity)
452
-
453
- ### 0.27.1
454
-
455
- • Bug Fix
456
-
457
- ### 0.27.0
458
-
459
- • Neue Icons hinzugefügt (Computer)
460
-
461
- ### 0.26.0
462
-
463
- • Neue Icons hinzugefügt (Computer)
464
-
465
- ### 0.25.0
466
-
467
- • Neue Icons hinzugefügt (Navigation)
468
-
469
- ### 0.24.0
470
-
471
- • Neue Icons hinzugefügt (Network)
472
-
473
- ### 0.23.0
474
-
475
- • Neue Icons hinzugefügt (Amazon Echo)
476
-
477
- ### 0.22.2
478
-
479
- • Bug-Fix
480
-
481
- ### 0.22.1
482
-
483
- • Icongröße angepasst
484
-
485
- ### 0.22.0
486
-
487
- • Neue Icons hinzugefügt (Amazon Echo)
488
-
489
- ### 0.21.1
490
-
491
- • Code angepasst
492
-
493
- ### 0.21.0
494
-
495
- • Neue Icons hinzugefügt (Electricity)
496
-
497
- ### 0.20.1
498
-
499
- • Code angepasst (adminTab & localLink)
500
-
501
-
502
- ### 0.20.0
503
-
504
- • Neue Icons hinzugefügt (Battery)
505
-
506
- ### 0.19.4
507
-
508
- • Neue Icons hinzugefügt (Weather)
509
-
510
- ### 0.19.3
511
-
512
- • Neue Icons hinzugefügt (Alarm colored)
513
-
514
- ### 0.19.2
515
-
516
- • Neue Icons hinzugefügt (Heating)
517
-
518
- ### 0.19.1
519
-
520
- • Index & Readme angepasst (Icon Overview)
521
-
522
- ### 0.19.0
523
-
524
- • Neue Icons hinzugefügt (Lights & Alarm)
525
-
526
- ### 0.18.0
527
-
528
- • Neue Icons hinzugefügt (Rooms)
529
-
530
- ### 0.17.1
531
-
532
- • Code angepasst
533
-
534
- ### 0.17.0
535
-
536
- • Neue Icons hinzugefügt (Network)
537
-
538
- ### 0.16.1
539
-
540
- • Code angepasst
541
-
542
- ### 0.16.0
543
-
544
- • Neue Hintergründe hinzugefügt (Backgrounds)
545
-
546
- ### 0.15.0
547
-
548
- • Neue Hintergründe hinzugefügt (Backgrounds)
549
-
550
- ### 0.14.0
551
-
552
- • Neue Icons hinzugefügt (Schedules)
553
-
554
- ### 0.13.0
555
-
556
- • Neue Icons hinzugefügt (Lights)
557
-
558
- ### 0.12.0
559
-
560
- • Neue Icons hinzugefügt (Lights)
561
-
562
- ### 0.11.0
563
-
564
- • Neue Icons hinzugefügt (Phones_Tablets)
565
-
566
- ### 0.10.0
567
-
568
- • Neue Icons hinzugefügt (Cooling)
569
-
570
- ### 0.9.0
571
-
572
- • Neue Icons hinzugefügt (Devices)
573
-
574
- ### 0.8.0
575
-
576
- • Neue Icons hinzugefügt (Cooling & Weather)
577
-
578
- ### 0.7.0
579
-
580
- • Neue Icons hinzugefügt (Cooling)
581
-
582
- ### 0.6.0
583
-
584
- • Neue Icons hinzugefügt (Devices)
585
-
586
- ### 0.5.0
587
-
588
- • Neue Icons hinzugefügt (Brands)
589
-
590
- ### 0.4.0
591
-
592
- • Neue Icons hinzugefügt (Cooling)
593
-
594
- ### 0.3.0
595
-
596
- • Neue Icons hinzugefügt (Cooling)
597
-
598
- ### 0.2.0
599
-
600
- • Neue Icons hinzugefügt (Brands)
601
-
602
- ### 0.1.11
603
-
604
- • Bug-Fix
605
-
606
- ### 0.1.10
607
-
608
- • Neue Icons hinzugefügt (Brands)
609
-
610
- ### 0.1.9
611
-
612
- • Neue Icons hinzugefügt (Weather)
613
-
614
- ### 0.1.8
615
-
616
- • Bug-Fix
617
-
618
- ### 0.1.7
619
-
620
- • Code angepasst
621
-
622
- ### 0.1.6
623
-
624
- • Neue Icons hinzugefügt (Nav and Lights)
625
-
626
- ### 0.1.5
627
-
628
- • Neue Icons hinzugefügt (Garage)
629
-
630
- ### 0.1.4
631
-
632
- • Neue Icons hinzugefügt (Lampen)
633
-
634
- ### 0.1.3
635
-
636
- • Neue Icons hinzugefügt
637
-
638
- ### 0.1.2
639
-
640
- • Code angepasst
641
-
642
- ### 0.1.1
643
-
644
- • Bug-Fix
645
-
646
- ### 0.1.0
647
-
648
- • Erstveröffentlichung
649
-
650
- ### 0.0.1
651
- • Die Idee ist geboren (16.05.2020)
652
-
653
86
  ## Older changes
654
87
  - [CHANGELOG_OLD.md](CHANGELOG_OLD.md)
655
88
 
package/io-package.json CHANGED
@@ -1,8 +1,21 @@
1
1
  {
2
2
  "common": {
3
3
  "name": "vis-icontwo",
4
- "version": "1.18.0",
4
+ "version": "1.18.6",
5
5
  "news": {
6
+ "1.18.6": {
7
+ "en": "Bugfix",
8
+ "de": "Bugfix",
9
+ "ru": "Исправлена ошибка",
10
+ "pt": "Correção de bug",
11
+ "nl": "Bugfix",
12
+ "fr": "Correction de bug",
13
+ "it": "Correzione di bug",
14
+ "es": "Corrección de errores",
15
+ "pl": "Naprawiono błąd",
16
+ "uk": "Виправлення помилки",
17
+ "zh-cn": "错误修复"
18
+ },
6
19
  "1.18.0": {
7
20
  "en": "new icons added",
8
21
  "de": "neue icons hinzugefügt",
package/package.json CHANGED
@@ -1,61 +1,64 @@
1
- {
2
- "name": "iobroker.vis-icontwo",
3
- "version": "1.18.1",
4
- "description": "inventwo Icon Set",
5
- "author": "skvarel <skvarel@inventwo.com>",
6
- "contributors": [
7
- "jkvarel <jkvarel@inventwo.com>",
8
- "skvarel <skvarel@inventwo.com>"
9
- ],
10
- "homepage": "https://github.com/inventwo/ioBroker.vis-icontwo",
11
- "license": "MIT",
12
- "files": [
13
- "admin/",
14
- "img/",
15
- "lib/",
16
- "www/",
17
- "io-package.json",
18
- "LICENSE"
19
- ],
20
- "keywords": [
21
- "ioBroker",
22
- "template",
23
- "Smart Home",
24
- "home automation",
25
- "inventwo",
26
- "vis",
27
- "Icons"
28
- ],
29
- "readmeFilename": "README.md",
30
- "repository": {
31
- "type": "git",
32
- "url": "git+https://github.com/inventwo/ioBroker.vis-icontwo.git"
33
- },
34
- "dependencies": {
35
- "minimist": "^1.2.5",
36
- "np": "^10.0.2"
37
- },
38
- "devDependencies": {
39
- "chai": "^4.3.7",
40
- "chai-as-promised": "^7.1.1",
41
- "mocha": "^11.0.1",
42
- "proxyquire": "^2.1.3",
43
- "release-it": "^19.2.4",
44
- "sinon": "^21.0.0",
45
- "sinon-chai": "^3.7.0"
46
- },
47
- "scripts": {
48
- "test": "echo 'No tests for icon-only adapter'",
49
- "release": "release-it",
50
- "release:patch": "release-it --increment=patch",
51
- "release:minor": "release-it --increment=minor",
52
- "release:major": "release-it --increment=major"
53
- },
54
- "bugs": {
55
- "url": "https://github.com/inventwo/ioBroker.vis-icontwo/issues"
56
- },
57
- "directories": {
58
- "lib": "lib",
59
- "test": "test"
60
- }
61
- }
1
+ {
2
+ "name": "iobroker.vis-icontwo",
3
+ "version": "1.18.6",
4
+ "description": "inventwo Icon Set",
5
+ "author": "skvarel <skvarel@inventwo.com>",
6
+ "contributors": [
7
+ "jkvarel <jkvarel@inventwo.com>",
8
+ "skvarel <skvarel@inventwo.com>"
9
+ ],
10
+ "homepage": "https://github.com/inventwo/ioBroker.vis-icontwo",
11
+ "license": "MIT",
12
+ "files": [
13
+ "admin/",
14
+ "img/",
15
+ "lib/",
16
+ "www/",
17
+ "io-package.json",
18
+ "LICENSE"
19
+ ],
20
+ "keywords": [
21
+ "ioBroker",
22
+ "template",
23
+ "Smart Home",
24
+ "home automation",
25
+ "inventwo",
26
+ "vis",
27
+ "Icons"
28
+ ],
29
+ "readmeFilename": "README.md",
30
+ "repository": {
31
+ "type": "git",
32
+ "url": "git+https://github.com/inventwo/ioBroker.vis-icontwo.git"
33
+ },
34
+ "dependencies": {
35
+ "minimist": "^1.2.5",
36
+ "np": "^10.0.2"
37
+ },
38
+ "devDependencies": {
39
+ "@alcalzone/release-script": "^5.0.0",
40
+ "@iobroker/eslint-config": "^2.2.0",
41
+ "chai": "^4.3.7",
42
+ "chai-as-promised": "^7.1.1",
43
+ "eslint": "^9.39.2",
44
+ "mocha": "^11.0.1",
45
+ "proxyquire": "^2.1.3",
46
+ "release-it": "^19.2.4",
47
+ "sinon": "^21.0.0",
48
+ "sinon-chai": "^3.7.0"
49
+ },
50
+ "scripts": {
51
+ "test": "echo 'No tests for icon-only adapter'",
52
+ "release": "release-script",
53
+ "release:patch": "release-script patch",
54
+ "release:minor": "release-script minor",
55
+ "release:major": "release-script major"
56
+ },
57
+ "bugs": {
58
+ "url": "https://github.com/inventwo/ioBroker.vis-icontwo/issues"
59
+ },
60
+ "directories": {
61
+ "lib": "lib",
62
+ "test": "test"
63
+ }
64
+ }
@@ -1,16 +0,0 @@
1
- // This file extends the AdapterConfig type from "@types/ioBroker"
2
- // using the actual properties present in io-package.json
3
- // in order to provide typings for adapter.config properties
4
-
5
- import { native } from "../io-package.json";
6
-
7
- type _AdapterConfig = typeof native;
8
-
9
- // Augment the globally declared type ioBroker.AdapterConfig
10
- declare global {
11
- namespace ioBroker {
12
- interface AdapterConfig extends _AdapterConfig {
13
- // Do not enter anything here!
14
- }
15
- }
16
- }
package/lib/tools.js DELETED
@@ -1,91 +0,0 @@
1
- const axios = require("axios");
2
-
3
- /**
4
- * Tests whether the given variable is a real object and not an Array
5
- * @param {any} it The variable to test
6
- * @returns {it is Record<string, any>}
7
- */
8
- function isObject(it) {
9
- // This is necessary because:
10
- // typeof null === 'object'
11
- // typeof [] === 'object'
12
- // [] instanceof Object === true
13
- return Object.prototype.toString.call(it) === "[object Object]";
14
- }
15
-
16
- /**
17
- * Tests whether the given variable is really an Array
18
- * @param {any} it The variable to test
19
- * @returns {it is any[]}
20
- */
21
- function isArray(it) {
22
- if (typeof Array.isArray === "function") return Array.isArray(it);
23
- return Object.prototype.toString.call(it) === "[object Array]";
24
- }
25
-
26
- /**
27
- * Translates text to the target language. Automatically chooses the right translation API.
28
- * @param {string} text The text to translate
29
- * @param {string} targetLang The target languate
30
- * @param {string} [yandexApiKey] The yandex API key. You can create one for free at https://translate.yandex.com/developers
31
- * @returns {Promise<string>}
32
- */
33
- async function translateText(text, targetLang, yandexApiKey) {
34
- if (targetLang === "en") {
35
- return text;
36
- }
37
- if (yandexApiKey) {
38
- return await translateYandex(text, targetLang, yandexApiKey);
39
- } else {
40
- return await translateGoogle(text, targetLang);
41
- }
42
- }
43
-
44
- /**
45
- * Translates text with Yandex API
46
- * @param {string} text The text to translate
47
- * @param {string} targetLang The target languate
48
- * @param {string} [apiKey] The yandex API key. You can create one for free at https://translate.yandex.com/developers
49
- * @returns {Promise<string>}
50
- */
51
- async function translateYandex(text, targetLang, apiKey) {
52
- if (targetLang === "zh-cn") {
53
- targetLang = "zh";
54
- }
55
- try {
56
- const url = `https://translate.yandex.net/api/v1.5/tr.json/translate?key=${apiKey}&text=${encodeURIComponent(text)}&lang=en-${targetLang}`;
57
- const response = await axios({url, timeout: 15000});
58
- if (response.data && response.data["text"]) {
59
- return response.data["text"][0];
60
- }
61
- throw new Error("Invalid response for translate request");
62
- } catch (e) {
63
- throw new Error(`Could not translate to "${targetLang}": ${e}`);
64
- }
65
- }
66
-
67
- /**
68
- * Translates text with Google API
69
- * @param {string} text The text to translate
70
- * @param {string} targetLang The target languate
71
- * @returns {Promise<string>}
72
- */
73
- async function translateGoogle(text, targetLang) {
74
- try {
75
- const url = `http://translate.googleapis.com/translate_a/single?client=gtx&sl=en&tl=${targetLang}&dt=t&q=${encodeURIComponent(text)}&ie=UTF-8&oe=UTF-8`;
76
- const response = await axios({url, timeout: 15000});
77
- if (isArray(response.data)) {
78
- // we got a valid response
79
- return response.data[0][0][0];
80
- }
81
- throw new Error("Invalid response for translate request");
82
- } catch (e) {
83
- throw new Error(`Could not translate to "${targetLang}": ${e}`);
84
- }
85
- }
86
-
87
- module.exports = {
88
- isArray,
89
- isObject,
90
- translateText
91
- };