@itwin/core-i18n 3.5.0-dev.43 → 3.5.0-dev.47
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/lib/cjs/ITwinLocalization.d.ts +2 -1
- package/lib/cjs/ITwinLocalization.d.ts.map +1 -1
- package/lib/cjs/ITwinLocalization.js +6 -1
- package/lib/cjs/ITwinLocalization.js.map +1 -1
- package/lib/cjs/test/ITwinLocalization.test.js +756 -3
- package/lib/cjs/test/ITwinLocalization.test.js.map +1 -1
- package/lib/cjs/test/webpack/bundled-tests.instrumented.js +1262 -491
- package/lib/cjs/test/webpack/bundled-tests.instrumented.js.map +1 -1
- package/lib/cjs/test/webpack/bundled-tests.js +811 -53
- package/lib/cjs/test/webpack/bundled-tests.js.map +1 -1
- package/lib/esm/ITwinLocalization.d.ts +2 -1
- package/lib/esm/ITwinLocalization.d.ts.map +1 -1
- package/lib/esm/ITwinLocalization.js +6 -1
- package/lib/esm/ITwinLocalization.js.map +1 -1
- package/lib/esm/test/ITwinLocalization.test.js +756 -3
- package/lib/esm/test/ITwinLocalization.test.js.map +1 -1
- package/package.json +9 -9
|
@@ -17,13 +17,13 @@
|
|
|
17
17
|
/** @packageDocumentation
|
|
18
18
|
* @module Localization
|
|
19
19
|
*/
|
|
20
|
-
function
|
|
21
|
-
var path = "D:\\
|
|
22
|
-
var hash = "
|
|
20
|
+
function cov_29ajiy3676() {
|
|
21
|
+
var path = "D:\\vsts_a\\1\\s\\core\\i18n\\lib\\cjs\\ITwinLocalization.js";
|
|
22
|
+
var hash = "7e07cc3560d3d5f83d31338f926e741c63e5de79";
|
|
23
23
|
var global = new Function("return this")();
|
|
24
24
|
var gcv = "__coverage__";
|
|
25
25
|
var coverageData = {
|
|
26
|
-
path: "D:\\
|
|
26
|
+
path: "D:\\vsts_a\\1\\s\\core\\i18n\\lib\\cjs\\ITwinLocalization.js",
|
|
27
27
|
statementMap: {
|
|
28
28
|
"0": {
|
|
29
29
|
start: {
|
|
@@ -377,481 +377,491 @@ function cov_yuojz2wow() {
|
|
|
377
377
|
},
|
|
378
378
|
"35": {
|
|
379
379
|
start: {
|
|
380
|
-
line:
|
|
380
|
+
line: 124,
|
|
381
381
|
column: 22
|
|
382
382
|
},
|
|
383
383
|
end: {
|
|
384
|
-
line:
|
|
384
|
+
line: 124,
|
|
385
385
|
column: 24
|
|
386
386
|
}
|
|
387
387
|
},
|
|
388
388
|
"36": {
|
|
389
389
|
start: {
|
|
390
|
-
line:
|
|
390
|
+
line: 125,
|
|
391
391
|
column: 8
|
|
392
392
|
},
|
|
393
393
|
end: {
|
|
394
|
-
line:
|
|
394
|
+
line: 132,
|
|
395
395
|
column: 9
|
|
396
396
|
}
|
|
397
397
|
},
|
|
398
398
|
"37": {
|
|
399
399
|
start: {
|
|
400
|
-
line:
|
|
400
|
+
line: 126,
|
|
401
401
|
column: 12
|
|
402
402
|
},
|
|
403
403
|
end: {
|
|
404
|
-
line:
|
|
404
|
+
line: 126,
|
|
405
405
|
column: 44
|
|
406
406
|
}
|
|
407
407
|
},
|
|
408
408
|
"38": {
|
|
409
409
|
start: {
|
|
410
|
-
line:
|
|
410
|
+
line: 129,
|
|
411
411
|
column: 12
|
|
412
412
|
},
|
|
413
413
|
end: {
|
|
414
|
-
line:
|
|
414
|
+
line: 131,
|
|
415
415
|
column: 15
|
|
416
416
|
}
|
|
417
417
|
},
|
|
418
418
|
"39": {
|
|
419
419
|
start: {
|
|
420
|
-
line:
|
|
420
|
+
line: 130,
|
|
421
421
|
column: 16
|
|
422
422
|
},
|
|
423
423
|
end: {
|
|
424
|
-
line:
|
|
424
|
+
line: 130,
|
|
425
425
|
column: 48
|
|
426
426
|
}
|
|
427
427
|
},
|
|
428
428
|
"40": {
|
|
429
429
|
start: {
|
|
430
|
-
line:
|
|
430
|
+
line: 133,
|
|
431
431
|
column: 8
|
|
432
432
|
},
|
|
433
433
|
end: {
|
|
434
|
-
line:
|
|
434
|
+
line: 133,
|
|
435
435
|
column: 57
|
|
436
436
|
}
|
|
437
437
|
},
|
|
438
438
|
"41": {
|
|
439
439
|
start: {
|
|
440
|
-
line:
|
|
440
|
+
line: 143,
|
|
441
441
|
column: 8
|
|
442
442
|
},
|
|
443
443
|
end: {
|
|
444
|
-
line:
|
|
444
|
+
line: 145,
|
|
445
445
|
column: 9
|
|
446
446
|
}
|
|
447
447
|
},
|
|
448
448
|
"42": {
|
|
449
449
|
start: {
|
|
450
|
-
line:
|
|
450
|
+
line: 144,
|
|
451
451
|
column: 12
|
|
452
452
|
},
|
|
453
453
|
end: {
|
|
454
|
-
line:
|
|
454
|
+
line: 144,
|
|
455
455
|
column: 116
|
|
456
456
|
}
|
|
457
457
|
},
|
|
458
458
|
"43": {
|
|
459
459
|
start: {
|
|
460
|
-
line:
|
|
460
|
+
line: 146,
|
|
461
|
+
column: 8
|
|
462
|
+
},
|
|
463
|
+
end: {
|
|
464
|
+
line: 149,
|
|
465
|
+
column: 10
|
|
466
|
+
}
|
|
467
|
+
},
|
|
468
|
+
"44": {
|
|
469
|
+
start: {
|
|
470
|
+
line: 150,
|
|
461
471
|
column: 19
|
|
462
472
|
},
|
|
463
473
|
end: {
|
|
464
|
-
line:
|
|
474
|
+
line: 150,
|
|
465
475
|
column: 58
|
|
466
476
|
}
|
|
467
477
|
},
|
|
468
|
-
"
|
|
478
|
+
"45": {
|
|
469
479
|
start: {
|
|
470
|
-
line:
|
|
480
|
+
line: 151,
|
|
471
481
|
column: 20
|
|
472
482
|
},
|
|
473
483
|
end: {
|
|
474
|
-
line:
|
|
484
|
+
line: 151,
|
|
475
485
|
column: 36
|
|
476
486
|
}
|
|
477
487
|
},
|
|
478
|
-
"
|
|
488
|
+
"46": {
|
|
479
489
|
start: {
|
|
480
|
-
line:
|
|
490
|
+
line: 152,
|
|
481
491
|
column: 8
|
|
482
492
|
},
|
|
483
493
|
end: {
|
|
484
|
-
line:
|
|
494
|
+
line: 153,
|
|
485
495
|
column: 60
|
|
486
496
|
}
|
|
487
497
|
},
|
|
488
|
-
"
|
|
498
|
+
"47": {
|
|
489
499
|
start: {
|
|
490
|
-
line:
|
|
500
|
+
line: 153,
|
|
491
501
|
column: 12
|
|
492
502
|
},
|
|
493
503
|
end: {
|
|
494
|
-
line:
|
|
504
|
+
line: 153,
|
|
495
505
|
column: 60
|
|
496
506
|
}
|
|
497
507
|
},
|
|
498
|
-
"
|
|
508
|
+
"48": {
|
|
499
509
|
start: {
|
|
500
|
-
line:
|
|
510
|
+
line: 154,
|
|
501
511
|
column: 8
|
|
502
512
|
},
|
|
503
513
|
end: {
|
|
504
|
-
line:
|
|
514
|
+
line: 154,
|
|
505
515
|
column: 19
|
|
506
516
|
}
|
|
507
517
|
},
|
|
508
|
-
"
|
|
518
|
+
"49": {
|
|
509
519
|
start: {
|
|
510
|
-
line:
|
|
520
|
+
line: 161,
|
|
511
521
|
column: 8
|
|
512
522
|
},
|
|
513
523
|
end: {
|
|
514
|
-
line:
|
|
524
|
+
line: 161,
|
|
515
525
|
column: 42
|
|
516
526
|
}
|
|
517
527
|
},
|
|
518
|
-
"
|
|
528
|
+
"50": {
|
|
519
529
|
start: {
|
|
520
|
-
line:
|
|
530
|
+
line: 165,
|
|
521
531
|
column: 8
|
|
522
532
|
},
|
|
523
533
|
end: {
|
|
524
|
-
line:
|
|
534
|
+
line: 165,
|
|
525
535
|
column: 38
|
|
526
536
|
}
|
|
527
537
|
},
|
|
528
|
-
"
|
|
538
|
+
"51": {
|
|
529
539
|
start: {
|
|
530
|
-
line:
|
|
540
|
+
line: 169,
|
|
531
541
|
column: 8
|
|
532
542
|
},
|
|
533
543
|
end: {
|
|
534
|
-
line:
|
|
544
|
+
line: 169,
|
|
535
545
|
column: 53
|
|
536
546
|
}
|
|
537
547
|
},
|
|
538
|
-
"
|
|
548
|
+
"52": {
|
|
539
549
|
start: {
|
|
540
|
-
line:
|
|
550
|
+
line: 180,
|
|
541
551
|
column: 25
|
|
542
552
|
},
|
|
543
553
|
end: {
|
|
544
|
-
line:
|
|
554
|
+
line: 180,
|
|
545
555
|
column: 51
|
|
546
556
|
}
|
|
547
557
|
},
|
|
548
|
-
"
|
|
558
|
+
"53": {
|
|
549
559
|
start: {
|
|
550
|
-
line:
|
|
560
|
+
line: 181,
|
|
551
561
|
column: 8
|
|
552
562
|
},
|
|
553
563
|
end: {
|
|
554
|
-
line:
|
|
564
|
+
line: 182,
|
|
555
565
|
column: 28
|
|
556
566
|
}
|
|
557
567
|
},
|
|
558
|
-
"
|
|
568
|
+
"54": {
|
|
559
569
|
start: {
|
|
560
|
-
line:
|
|
570
|
+
line: 182,
|
|
561
571
|
column: 12
|
|
562
572
|
},
|
|
563
573
|
end: {
|
|
564
|
-
line:
|
|
574
|
+
line: 182,
|
|
565
575
|
column: 28
|
|
566
576
|
}
|
|
567
577
|
},
|
|
568
|
-
"
|
|
578
|
+
"55": {
|
|
569
579
|
start: {
|
|
570
|
-
line:
|
|
580
|
+
line: 183,
|
|
571
581
|
column: 31
|
|
572
582
|
},
|
|
573
583
|
end: {
|
|
574
|
-
line:
|
|
584
|
+
line: 208,
|
|
575
585
|
column: 10
|
|
576
586
|
}
|
|
577
587
|
},
|
|
578
|
-
"
|
|
588
|
+
"56": {
|
|
579
589
|
start: {
|
|
580
|
-
line:
|
|
590
|
+
line: 185,
|
|
581
591
|
column: 12
|
|
582
592
|
},
|
|
583
593
|
end: {
|
|
584
|
-
line:
|
|
594
|
+
line: 207,
|
|
585
595
|
column: 15
|
|
586
596
|
}
|
|
587
597
|
},
|
|
588
|
-
"
|
|
598
|
+
"57": {
|
|
589
599
|
start: {
|
|
590
|
-
line:
|
|
600
|
+
line: 186,
|
|
591
601
|
column: 16
|
|
592
602
|
},
|
|
593
603
|
end: {
|
|
594
|
-
line:
|
|
604
|
+
line: 187,
|
|
595
605
|
column: 37
|
|
596
606
|
}
|
|
597
607
|
},
|
|
598
|
-
"
|
|
608
|
+
"58": {
|
|
599
609
|
start: {
|
|
600
|
-
line:
|
|
610
|
+
line: 187,
|
|
601
611
|
column: 20
|
|
602
612
|
},
|
|
603
613
|
end: {
|
|
604
|
-
line:
|
|
614
|
+
line: 187,
|
|
605
615
|
column: 37
|
|
606
616
|
}
|
|
607
617
|
},
|
|
608
|
-
"
|
|
618
|
+
"59": {
|
|
609
619
|
start: {
|
|
610
|
-
line:
|
|
620
|
+
line: 193,
|
|
611
621
|
column: 30
|
|
612
622
|
},
|
|
613
623
|
end: {
|
|
614
|
-
line:
|
|
624
|
+
line: 193,
|
|
615
625
|
column: 91
|
|
616
626
|
}
|
|
617
627
|
},
|
|
618
|
-
"
|
|
628
|
+
"60": {
|
|
619
629
|
start: {
|
|
620
|
-
line:
|
|
630
|
+
line: 193,
|
|
621
631
|
column: 73
|
|
622
632
|
},
|
|
623
633
|
end: {
|
|
624
|
-
line:
|
|
634
|
+
line: 193,
|
|
625
635
|
column: 90
|
|
626
636
|
}
|
|
627
637
|
},
|
|
628
|
-
"
|
|
638
|
+
"61": {
|
|
629
639
|
start: {
|
|
630
|
-
line:
|
|
640
|
+
line: 194,
|
|
631
641
|
column: 16
|
|
632
642
|
},
|
|
633
643
|
end: {
|
|
634
|
-
line:
|
|
644
|
+
line: 202,
|
|
635
645
|
column: 17
|
|
636
646
|
}
|
|
637
647
|
},
|
|
638
|
-
"
|
|
648
|
+
"62": {
|
|
639
649
|
start: {
|
|
640
|
-
line:
|
|
650
|
+
line: 195,
|
|
641
651
|
column: 20
|
|
642
652
|
},
|
|
643
653
|
end: {
|
|
644
|
-
line:
|
|
654
|
+
line: 198,
|
|
645
655
|
column: 21
|
|
646
656
|
}
|
|
647
657
|
},
|
|
648
|
-
"
|
|
658
|
+
"63": {
|
|
649
659
|
start: {
|
|
650
|
-
line:
|
|
660
|
+
line: 196,
|
|
651
661
|
column: 24
|
|
652
662
|
},
|
|
653
663
|
end: {
|
|
654
|
-
line:
|
|
664
|
+
line: 197,
|
|
655
665
|
column: 102
|
|
656
666
|
}
|
|
657
667
|
},
|
|
658
|
-
"
|
|
668
|
+
"64": {
|
|
659
669
|
start: {
|
|
660
|
-
line:
|
|
670
|
+
line: 197,
|
|
661
671
|
column: 28
|
|
662
672
|
},
|
|
663
673
|
end: {
|
|
664
|
-
line:
|
|
674
|
+
line: 197,
|
|
665
675
|
column: 102
|
|
666
676
|
}
|
|
667
677
|
},
|
|
668
|
-
"
|
|
678
|
+
"65": {
|
|
669
679
|
start: {
|
|
670
|
-
line:
|
|
680
|
+
line: 197,
|
|
671
681
|
column: 69
|
|
672
682
|
},
|
|
673
683
|
end: {
|
|
674
|
-
line:
|
|
684
|
+
line: 197,
|
|
675
685
|
column: 100
|
|
676
686
|
}
|
|
677
687
|
},
|
|
678
|
-
"
|
|
688
|
+
"66": {
|
|
679
689
|
start: {
|
|
680
|
-
line:
|
|
690
|
+
line: 201,
|
|
681
691
|
column: 20
|
|
682
692
|
},
|
|
683
693
|
end: {
|
|
684
|
-
line:
|
|
694
|
+
line: 201,
|
|
685
695
|
column: 33
|
|
686
696
|
}
|
|
687
697
|
},
|
|
688
|
-
"
|
|
698
|
+
"67": {
|
|
689
699
|
start: {
|
|
690
|
-
line:
|
|
700
|
+
line: 204,
|
|
691
701
|
column: 16
|
|
692
702
|
},
|
|
693
703
|
end: {
|
|
694
|
-
line:
|
|
704
|
+
line: 205,
|
|
695
705
|
column: 113
|
|
696
706
|
}
|
|
697
707
|
},
|
|
698
|
-
"
|
|
708
|
+
"68": {
|
|
699
709
|
start: {
|
|
700
|
-
line:
|
|
710
|
+
line: 205,
|
|
701
711
|
column: 20
|
|
702
712
|
},
|
|
703
713
|
end: {
|
|
704
|
-
line:
|
|
714
|
+
line: 205,
|
|
705
715
|
column: 113
|
|
706
716
|
}
|
|
707
717
|
},
|
|
708
|
-
"
|
|
718
|
+
"69": {
|
|
709
719
|
start: {
|
|
710
|
-
line:
|
|
720
|
+
line: 206,
|
|
711
721
|
column: 16
|
|
712
722
|
},
|
|
713
723
|
end: {
|
|
714
|
-
line:
|
|
724
|
+
line: 206,
|
|
715
725
|
column: 26
|
|
716
726
|
}
|
|
717
727
|
},
|
|
718
|
-
"
|
|
728
|
+
"70": {
|
|
719
729
|
start: {
|
|
720
|
-
line:
|
|
730
|
+
line: 209,
|
|
721
731
|
column: 8
|
|
722
732
|
},
|
|
723
733
|
end: {
|
|
724
|
-
line:
|
|
734
|
+
line: 209,
|
|
725
735
|
column: 51
|
|
726
736
|
}
|
|
727
737
|
},
|
|
728
|
-
"
|
|
738
|
+
"71": {
|
|
729
739
|
start: {
|
|
730
|
-
line:
|
|
740
|
+
line: 210,
|
|
731
741
|
column: 8
|
|
732
742
|
},
|
|
733
743
|
end: {
|
|
734
|
-
line:
|
|
744
|
+
line: 210,
|
|
735
745
|
column: 30
|
|
736
746
|
}
|
|
737
747
|
},
|
|
738
|
-
"
|
|
748
|
+
"72": {
|
|
739
749
|
start: {
|
|
740
|
-
line:
|
|
750
|
+
line: 214,
|
|
741
751
|
column: 8
|
|
742
752
|
},
|
|
743
753
|
end: {
|
|
744
|
-
line:
|
|
754
|
+
line: 214,
|
|
745
755
|
column: 38
|
|
746
756
|
}
|
|
747
757
|
},
|
|
748
|
-
"
|
|
758
|
+
"73": {
|
|
749
759
|
start: {
|
|
750
|
-
line:
|
|
760
|
+
line: 217,
|
|
751
761
|
column: 0
|
|
752
762
|
},
|
|
753
763
|
end: {
|
|
754
|
-
line:
|
|
764
|
+
line: 217,
|
|
755
765
|
column: 46
|
|
756
766
|
}
|
|
757
767
|
},
|
|
758
|
-
"
|
|
768
|
+
"74": {
|
|
759
769
|
start: {
|
|
760
|
-
line:
|
|
770
|
+
line: 219,
|
|
761
771
|
column: 16
|
|
762
772
|
},
|
|
763
773
|
end: {
|
|
764
|
-
line:
|
|
774
|
+
line: 219,
|
|
765
775
|
column: 83
|
|
766
776
|
}
|
|
767
777
|
},
|
|
768
|
-
"
|
|
778
|
+
"75": {
|
|
769
779
|
start: {
|
|
770
|
-
line:
|
|
780
|
+
line: 220,
|
|
771
781
|
column: 17
|
|
772
782
|
},
|
|
773
783
|
end: {
|
|
774
|
-
line:
|
|
784
|
+
line: 220,
|
|
775
785
|
column: 87
|
|
776
786
|
}
|
|
777
787
|
},
|
|
778
|
-
"
|
|
788
|
+
"76": {
|
|
779
789
|
start: {
|
|
780
|
-
line:
|
|
790
|
+
line: 221,
|
|
781
791
|
column: 18
|
|
782
792
|
},
|
|
783
793
|
end: {
|
|
784
|
-
line:
|
|
794
|
+
line: 221,
|
|
785
795
|
column: 86
|
|
786
796
|
}
|
|
787
797
|
},
|
|
788
|
-
"
|
|
798
|
+
"77": {
|
|
789
799
|
start: {
|
|
790
|
-
line:
|
|
800
|
+
line: 223,
|
|
791
801
|
column: 22
|
|
792
802
|
},
|
|
793
803
|
end: {
|
|
794
|
-
line:
|
|
804
|
+
line: 223,
|
|
795
805
|
column: 29
|
|
796
806
|
}
|
|
797
807
|
},
|
|
798
|
-
"
|
|
808
|
+
"78": {
|
|
799
809
|
start: {
|
|
800
|
-
line:
|
|
810
|
+
line: 224,
|
|
801
811
|
column: 8
|
|
802
812
|
},
|
|
803
813
|
end: {
|
|
804
|
-
line:
|
|
814
|
+
line: 227,
|
|
805
815
|
column: 9
|
|
806
816
|
}
|
|
807
817
|
},
|
|
808
|
-
"
|
|
818
|
+
"79": {
|
|
809
819
|
start: {
|
|
810
|
-
line:
|
|
820
|
+
line: 224,
|
|
811
821
|
column: 21
|
|
812
822
|
},
|
|
813
823
|
end: {
|
|
814
|
-
line:
|
|
824
|
+
line: 224,
|
|
815
825
|
column: 22
|
|
816
826
|
}
|
|
817
827
|
},
|
|
818
|
-
"
|
|
828
|
+
"80": {
|
|
819
829
|
start: {
|
|
820
|
-
line:
|
|
830
|
+
line: 225,
|
|
821
831
|
column: 12
|
|
822
832
|
},
|
|
823
833
|
end: {
|
|
824
|
-
line:
|
|
834
|
+
line: 226,
|
|
825
835
|
column: 44
|
|
826
836
|
}
|
|
827
837
|
},
|
|
828
|
-
"
|
|
838
|
+
"81": {
|
|
829
839
|
start: {
|
|
830
|
-
line:
|
|
840
|
+
line: 226,
|
|
831
841
|
column: 16
|
|
832
842
|
},
|
|
833
843
|
end: {
|
|
834
|
-
line:
|
|
844
|
+
line: 226,
|
|
835
845
|
column: 44
|
|
836
846
|
}
|
|
837
847
|
},
|
|
838
|
-
"
|
|
848
|
+
"82": {
|
|
839
849
|
start: {
|
|
840
|
-
line:
|
|
850
|
+
line: 228,
|
|
841
851
|
column: 8
|
|
842
852
|
},
|
|
843
853
|
end: {
|
|
844
|
-
line:
|
|
854
|
+
line: 228,
|
|
845
855
|
column: 23
|
|
846
856
|
}
|
|
847
857
|
},
|
|
848
|
-
"
|
|
858
|
+
"83": {
|
|
849
859
|
start: {
|
|
850
|
-
line:
|
|
860
|
+
line: 231,
|
|
851
861
|
column: 0
|
|
852
862
|
},
|
|
853
863
|
end: {
|
|
854
|
-
line:
|
|
864
|
+
line: 231,
|
|
855
865
|
column: 34
|
|
856
866
|
}
|
|
857
867
|
}
|
|
@@ -1005,385 +1015,385 @@ function cov_yuojz2wow() {
|
|
|
1005
1015
|
name: "(anonymous_6)",
|
|
1006
1016
|
decl: {
|
|
1007
1017
|
start: {
|
|
1008
|
-
line:
|
|
1018
|
+
line: 123,
|
|
1009
1019
|
column: 4
|
|
1010
1020
|
},
|
|
1011
1021
|
end: {
|
|
1012
|
-
line:
|
|
1022
|
+
line: 123,
|
|
1013
1023
|
column: 5
|
|
1014
1024
|
}
|
|
1015
1025
|
},
|
|
1016
1026
|
loc: {
|
|
1017
1027
|
start: {
|
|
1018
|
-
line:
|
|
1028
|
+
line: 123,
|
|
1019
1029
|
column: 61
|
|
1020
1030
|
},
|
|
1021
1031
|
end: {
|
|
1022
|
-
line:
|
|
1032
|
+
line: 134,
|
|
1023
1033
|
column: 5
|
|
1024
1034
|
}
|
|
1025
1035
|
},
|
|
1026
|
-
line:
|
|
1036
|
+
line: 123
|
|
1027
1037
|
},
|
|
1028
1038
|
"7": {
|
|
1029
1039
|
name: "(anonymous_7)",
|
|
1030
1040
|
decl: {
|
|
1031
1041
|
start: {
|
|
1032
|
-
line:
|
|
1042
|
+
line: 129,
|
|
1033
1043
|
column: 30
|
|
1034
1044
|
},
|
|
1035
1045
|
end: {
|
|
1036
|
-
line:
|
|
1046
|
+
line: 129,
|
|
1037
1047
|
column: 31
|
|
1038
1048
|
}
|
|
1039
1049
|
},
|
|
1040
1050
|
loc: {
|
|
1041
1051
|
start: {
|
|
1042
|
-
line:
|
|
1052
|
+
line: 129,
|
|
1043
1053
|
column: 42
|
|
1044
1054
|
},
|
|
1045
1055
|
end: {
|
|
1046
|
-
line:
|
|
1056
|
+
line: 131,
|
|
1047
1057
|
column: 13
|
|
1048
1058
|
}
|
|
1049
1059
|
},
|
|
1050
|
-
line:
|
|
1060
|
+
line: 129
|
|
1051
1061
|
},
|
|
1052
1062
|
"8": {
|
|
1053
1063
|
name: "(anonymous_8)",
|
|
1054
1064
|
decl: {
|
|
1055
1065
|
start: {
|
|
1056
|
-
line:
|
|
1066
|
+
line: 142,
|
|
1057
1067
|
column: 4
|
|
1058
1068
|
},
|
|
1059
1069
|
end: {
|
|
1060
|
-
line:
|
|
1070
|
+
line: 142,
|
|
1061
1071
|
column: 5
|
|
1062
1072
|
}
|
|
1063
1073
|
},
|
|
1064
1074
|
loc: {
|
|
1065
1075
|
start: {
|
|
1066
|
-
line:
|
|
1076
|
+
line: 142,
|
|
1067
1077
|
column: 46
|
|
1068
1078
|
},
|
|
1069
1079
|
end: {
|
|
1070
|
-
line:
|
|
1080
|
+
line: 155,
|
|
1071
1081
|
column: 5
|
|
1072
1082
|
}
|
|
1073
1083
|
},
|
|
1074
|
-
line:
|
|
1084
|
+
line: 142
|
|
1075
1085
|
},
|
|
1076
1086
|
"9": {
|
|
1077
1087
|
name: "(anonymous_9)",
|
|
1078
1088
|
decl: {
|
|
1079
1089
|
start: {
|
|
1080
|
-
line:
|
|
1090
|
+
line: 160,
|
|
1081
1091
|
column: 4
|
|
1082
1092
|
},
|
|
1083
1093
|
end: {
|
|
1084
|
-
line:
|
|
1094
|
+
line: 160,
|
|
1085
1095
|
column: 5
|
|
1086
1096
|
}
|
|
1087
1097
|
},
|
|
1088
1098
|
loc: {
|
|
1089
1099
|
start: {
|
|
1090
|
-
line:
|
|
1100
|
+
line: 160,
|
|
1091
1101
|
column: 30
|
|
1092
1102
|
},
|
|
1093
1103
|
end: {
|
|
1094
|
-
line:
|
|
1104
|
+
line: 162,
|
|
1095
1105
|
column: 5
|
|
1096
1106
|
}
|
|
1097
1107
|
},
|
|
1098
|
-
line:
|
|
1108
|
+
line: 160
|
|
1099
1109
|
},
|
|
1100
1110
|
"10": {
|
|
1101
1111
|
name: "(anonymous_10)",
|
|
1102
1112
|
decl: {
|
|
1103
1113
|
start: {
|
|
1104
|
-
line:
|
|
1114
|
+
line: 164,
|
|
1105
1115
|
column: 4
|
|
1106
1116
|
},
|
|
1107
1117
|
end: {
|
|
1108
|
-
line:
|
|
1118
|
+
line: 164,
|
|
1109
1119
|
column: 5
|
|
1110
1120
|
}
|
|
1111
1121
|
},
|
|
1112
1122
|
loc: {
|
|
1113
1123
|
start: {
|
|
1114
|
-
line:
|
|
1124
|
+
line: 164,
|
|
1115
1125
|
column: 22
|
|
1116
1126
|
},
|
|
1117
1127
|
end: {
|
|
1118
|
-
line:
|
|
1128
|
+
line: 166,
|
|
1119
1129
|
column: 5
|
|
1120
1130
|
}
|
|
1121
1131
|
},
|
|
1122
|
-
line:
|
|
1132
|
+
line: 164
|
|
1123
1133
|
},
|
|
1124
1134
|
"11": {
|
|
1125
1135
|
name: "(anonymous_11)",
|
|
1126
1136
|
decl: {
|
|
1127
1137
|
start: {
|
|
1128
|
-
line:
|
|
1138
|
+
line: 168,
|
|
1129
1139
|
column: 4
|
|
1130
1140
|
},
|
|
1131
1141
|
end: {
|
|
1132
|
-
line:
|
|
1142
|
+
line: 168,
|
|
1133
1143
|
column: 5
|
|
1134
1144
|
}
|
|
1135
1145
|
},
|
|
1136
1146
|
loc: {
|
|
1137
1147
|
start: {
|
|
1138
|
-
line:
|
|
1148
|
+
line: 168,
|
|
1139
1149
|
column: 35
|
|
1140
1150
|
},
|
|
1141
1151
|
end: {
|
|
1142
|
-
line:
|
|
1152
|
+
line: 170,
|
|
1143
1153
|
column: 5
|
|
1144
1154
|
}
|
|
1145
1155
|
},
|
|
1146
|
-
line:
|
|
1156
|
+
line: 168
|
|
1147
1157
|
},
|
|
1148
1158
|
"12": {
|
|
1149
1159
|
name: "(anonymous_12)",
|
|
1150
1160
|
decl: {
|
|
1151
1161
|
start: {
|
|
1152
|
-
line:
|
|
1162
|
+
line: 179,
|
|
1153
1163
|
column: 4
|
|
1154
1164
|
},
|
|
1155
1165
|
end: {
|
|
1156
|
-
line:
|
|
1166
|
+
line: 179,
|
|
1157
1167
|
column: 5
|
|
1158
1168
|
}
|
|
1159
1169
|
},
|
|
1160
1170
|
loc: {
|
|
1161
1171
|
start: {
|
|
1162
|
-
line:
|
|
1172
|
+
line: 179,
|
|
1163
1173
|
column: 34
|
|
1164
1174
|
},
|
|
1165
1175
|
end: {
|
|
1166
|
-
line:
|
|
1176
|
+
line: 211,
|
|
1167
1177
|
column: 5
|
|
1168
1178
|
}
|
|
1169
1179
|
},
|
|
1170
|
-
line:
|
|
1180
|
+
line: 179
|
|
1171
1181
|
},
|
|
1172
1182
|
"13": {
|
|
1173
1183
|
name: "(anonymous_13)",
|
|
1174
1184
|
decl: {
|
|
1175
1185
|
start: {
|
|
1176
|
-
line:
|
|
1186
|
+
line: 183,
|
|
1177
1187
|
column: 43
|
|
1178
1188
|
},
|
|
1179
1189
|
end: {
|
|
1180
|
-
line:
|
|
1190
|
+
line: 183,
|
|
1181
1191
|
column: 44
|
|
1182
1192
|
}
|
|
1183
1193
|
},
|
|
1184
1194
|
loc: {
|
|
1185
1195
|
start: {
|
|
1186
|
-
line:
|
|
1196
|
+
line: 183,
|
|
1187
1197
|
column: 56
|
|
1188
1198
|
},
|
|
1189
1199
|
end: {
|
|
1190
|
-
line:
|
|
1200
|
+
line: 208,
|
|
1191
1201
|
column: 9
|
|
1192
1202
|
}
|
|
1193
1203
|
},
|
|
1194
|
-
line:
|
|
1204
|
+
line: 183
|
|
1195
1205
|
},
|
|
1196
1206
|
"14": {
|
|
1197
1207
|
name: "(anonymous_14)",
|
|
1198
1208
|
decl: {
|
|
1199
1209
|
start: {
|
|
1200
|
-
line:
|
|
1210
|
+
line: 185,
|
|
1201
1211
|
column: 46
|
|
1202
1212
|
},
|
|
1203
1213
|
end: {
|
|
1204
|
-
line:
|
|
1214
|
+
line: 185,
|
|
1205
1215
|
column: 47
|
|
1206
1216
|
}
|
|
1207
1217
|
},
|
|
1208
1218
|
loc: {
|
|
1209
1219
|
start: {
|
|
1210
|
-
line:
|
|
1220
|
+
line: 185,
|
|
1211
1221
|
column: 55
|
|
1212
1222
|
},
|
|
1213
1223
|
end: {
|
|
1214
|
-
line:
|
|
1224
|
+
line: 207,
|
|
1215
1225
|
column: 13
|
|
1216
1226
|
}
|
|
1217
1227
|
},
|
|
1218
|
-
line:
|
|
1228
|
+
line: 185
|
|
1219
1229
|
},
|
|
1220
1230
|
"15": {
|
|
1221
1231
|
name: "(anonymous_15)",
|
|
1222
1232
|
decl: {
|
|
1223
1233
|
start: {
|
|
1224
|
-
line:
|
|
1234
|
+
line: 193,
|
|
1225
1235
|
column: 57
|
|
1226
1236
|
},
|
|
1227
1237
|
end: {
|
|
1228
|
-
line:
|
|
1238
|
+
line: 193,
|
|
1229
1239
|
column: 58
|
|
1230
1240
|
}
|
|
1231
1241
|
},
|
|
1232
1242
|
loc: {
|
|
1233
1243
|
start: {
|
|
1234
|
-
line:
|
|
1244
|
+
line: 193,
|
|
1235
1245
|
column: 73
|
|
1236
1246
|
},
|
|
1237
1247
|
end: {
|
|
1238
|
-
line:
|
|
1248
|
+
line: 193,
|
|
1239
1249
|
column: 90
|
|
1240
1250
|
}
|
|
1241
1251
|
},
|
|
1242
|
-
line:
|
|
1252
|
+
line: 193
|
|
1243
1253
|
},
|
|
1244
1254
|
"16": {
|
|
1245
1255
|
name: "(anonymous_16)",
|
|
1246
1256
|
decl: {
|
|
1247
1257
|
start: {
|
|
1248
|
-
line:
|
|
1258
|
+
line: 197,
|
|
1249
1259
|
column: 53
|
|
1250
1260
|
},
|
|
1251
1261
|
end: {
|
|
1252
|
-
line:
|
|
1262
|
+
line: 197,
|
|
1253
1263
|
column: 54
|
|
1254
1264
|
}
|
|
1255
1265
|
},
|
|
1256
1266
|
loc: {
|
|
1257
1267
|
start: {
|
|
1258
|
-
line:
|
|
1268
|
+
line: 197,
|
|
1259
1269
|
column: 69
|
|
1260
1270
|
},
|
|
1261
1271
|
end: {
|
|
1262
|
-
line:
|
|
1272
|
+
line: 197,
|
|
1263
1273
|
column: 100
|
|
1264
1274
|
}
|
|
1265
1275
|
},
|
|
1266
|
-
line:
|
|
1276
|
+
line: 197
|
|
1267
1277
|
},
|
|
1268
1278
|
"17": {
|
|
1269
1279
|
name: "(anonymous_17)",
|
|
1270
1280
|
decl: {
|
|
1271
1281
|
start: {
|
|
1272
|
-
line:
|
|
1282
|
+
line: 213,
|
|
1273
1283
|
column: 4
|
|
1274
1284
|
},
|
|
1275
1285
|
end: {
|
|
1276
|
-
line:
|
|
1286
|
+
line: 213,
|
|
1277
1287
|
column: 5
|
|
1278
1288
|
}
|
|
1279
1289
|
},
|
|
1280
1290
|
loc: {
|
|
1281
1291
|
start: {
|
|
1282
|
-
line:
|
|
1292
|
+
line: 213,
|
|
1283
1293
|
column: 30
|
|
1284
1294
|
},
|
|
1285
1295
|
end: {
|
|
1286
|
-
line:
|
|
1296
|
+
line: 215,
|
|
1287
1297
|
column: 5
|
|
1288
1298
|
}
|
|
1289
1299
|
},
|
|
1290
|
-
line:
|
|
1300
|
+
line: 213
|
|
1291
1301
|
},
|
|
1292
1302
|
"18": {
|
|
1293
1303
|
name: "(anonymous_18)",
|
|
1294
1304
|
decl: {
|
|
1295
1305
|
start: {
|
|
1296
|
-
line:
|
|
1306
|
+
line: 219,
|
|
1297
1307
|
column: 4
|
|
1298
1308
|
},
|
|
1299
1309
|
end: {
|
|
1300
|
-
line:
|
|
1310
|
+
line: 219,
|
|
1301
1311
|
column: 5
|
|
1302
1312
|
}
|
|
1303
1313
|
},
|
|
1304
1314
|
loc: {
|
|
1305
1315
|
start: {
|
|
1306
|
-
line:
|
|
1316
|
+
line: 219,
|
|
1307
1317
|
column: 14
|
|
1308
1318
|
},
|
|
1309
1319
|
end: {
|
|
1310
|
-
line:
|
|
1320
|
+
line: 219,
|
|
1311
1321
|
column: 85
|
|
1312
1322
|
}
|
|
1313
1323
|
},
|
|
1314
|
-
line:
|
|
1324
|
+
line: 219
|
|
1315
1325
|
},
|
|
1316
1326
|
"19": {
|
|
1317
1327
|
name: "(anonymous_19)",
|
|
1318
1328
|
decl: {
|
|
1319
1329
|
start: {
|
|
1320
|
-
line:
|
|
1330
|
+
line: 220,
|
|
1321
1331
|
column: 4
|
|
1322
1332
|
},
|
|
1323
1333
|
end: {
|
|
1324
|
-
line:
|
|
1334
|
+
line: 220,
|
|
1325
1335
|
column: 5
|
|
1326
1336
|
}
|
|
1327
1337
|
},
|
|
1328
1338
|
loc: {
|
|
1329
1339
|
start: {
|
|
1330
|
-
line:
|
|
1340
|
+
line: 220,
|
|
1331
1341
|
column: 15
|
|
1332
1342
|
},
|
|
1333
1343
|
end: {
|
|
1334
|
-
line:
|
|
1344
|
+
line: 220,
|
|
1335
1345
|
column: 89
|
|
1336
1346
|
}
|
|
1337
1347
|
},
|
|
1338
|
-
line:
|
|
1348
|
+
line: 220
|
|
1339
1349
|
},
|
|
1340
1350
|
"20": {
|
|
1341
1351
|
name: "(anonymous_20)",
|
|
1342
1352
|
decl: {
|
|
1343
1353
|
start: {
|
|
1344
|
-
line:
|
|
1354
|
+
line: 221,
|
|
1345
1355
|
column: 4
|
|
1346
1356
|
},
|
|
1347
1357
|
end: {
|
|
1348
|
-
line:
|
|
1358
|
+
line: 221,
|
|
1349
1359
|
column: 5
|
|
1350
1360
|
}
|
|
1351
1361
|
},
|
|
1352
1362
|
loc: {
|
|
1353
1363
|
start: {
|
|
1354
|
-
line:
|
|
1364
|
+
line: 221,
|
|
1355
1365
|
column: 16
|
|
1356
1366
|
},
|
|
1357
1367
|
end: {
|
|
1358
|
-
line:
|
|
1368
|
+
line: 221,
|
|
1359
1369
|
column: 88
|
|
1360
1370
|
}
|
|
1361
1371
|
},
|
|
1362
|
-
line:
|
|
1372
|
+
line: 221
|
|
1363
1373
|
},
|
|
1364
1374
|
"21": {
|
|
1365
1375
|
name: "(anonymous_21)",
|
|
1366
1376
|
decl: {
|
|
1367
1377
|
start: {
|
|
1368
|
-
line:
|
|
1378
|
+
line: 222,
|
|
1369
1379
|
column: 4
|
|
1370
1380
|
},
|
|
1371
1381
|
end: {
|
|
1372
|
-
line:
|
|
1382
|
+
line: 222,
|
|
1373
1383
|
column: 5
|
|
1374
1384
|
}
|
|
1375
1385
|
},
|
|
1376
1386
|
loc: {
|
|
1377
1387
|
start: {
|
|
1378
|
-
line:
|
|
1388
|
+
line: 222,
|
|
1379
1389
|
column: 27
|
|
1380
1390
|
},
|
|
1381
1391
|
end: {
|
|
1382
|
-
line:
|
|
1392
|
+
line: 229,
|
|
1383
1393
|
column: 5
|
|
1384
1394
|
}
|
|
1385
1395
|
},
|
|
1386
|
-
line:
|
|
1396
|
+
line: 222
|
|
1387
1397
|
}
|
|
1388
1398
|
},
|
|
1389
1399
|
branchMap: {
|
|
@@ -2488,55 +2498,55 @@ function cov_yuojz2wow() {
|
|
|
2488
2498
|
"33": {
|
|
2489
2499
|
loc: {
|
|
2490
2500
|
start: {
|
|
2491
|
-
line:
|
|
2501
|
+
line: 125,
|
|
2492
2502
|
column: 8
|
|
2493
2503
|
},
|
|
2494
2504
|
end: {
|
|
2495
|
-
line:
|
|
2505
|
+
line: 132,
|
|
2496
2506
|
column: 9
|
|
2497
2507
|
}
|
|
2498
2508
|
},
|
|
2499
2509
|
type: "if",
|
|
2500
2510
|
locations: [{
|
|
2501
2511
|
start: {
|
|
2502
|
-
line:
|
|
2512
|
+
line: 125,
|
|
2503
2513
|
column: 8
|
|
2504
2514
|
},
|
|
2505
2515
|
end: {
|
|
2506
|
-
line:
|
|
2516
|
+
line: 132,
|
|
2507
2517
|
column: 9
|
|
2508
2518
|
}
|
|
2509
2519
|
}, {
|
|
2510
2520
|
start: {
|
|
2511
|
-
line:
|
|
2521
|
+
line: 128,
|
|
2512
2522
|
column: 13
|
|
2513
2523
|
},
|
|
2514
2524
|
end: {
|
|
2515
|
-
line:
|
|
2525
|
+
line: 132,
|
|
2516
2526
|
column: 9
|
|
2517
2527
|
}
|
|
2518
2528
|
}],
|
|
2519
|
-
line:
|
|
2529
|
+
line: 125
|
|
2520
2530
|
},
|
|
2521
2531
|
"34": {
|
|
2522
2532
|
loc: {
|
|
2523
2533
|
start: {
|
|
2524
|
-
line:
|
|
2534
|
+
line: 143,
|
|
2525
2535
|
column: 8
|
|
2526
2536
|
},
|
|
2527
2537
|
end: {
|
|
2528
|
-
line:
|
|
2538
|
+
line: 145,
|
|
2529
2539
|
column: 9
|
|
2530
2540
|
}
|
|
2531
2541
|
},
|
|
2532
2542
|
type: "if",
|
|
2533
2543
|
locations: [{
|
|
2534
2544
|
start: {
|
|
2535
|
-
line:
|
|
2545
|
+
line: 143,
|
|
2536
2546
|
column: 8
|
|
2537
2547
|
},
|
|
2538
2548
|
end: {
|
|
2539
|
-
line:
|
|
2549
|
+
line: 145,
|
|
2540
2550
|
column: 9
|
|
2541
2551
|
}
|
|
2542
2552
|
}, {
|
|
@@ -2549,192 +2559,192 @@ function cov_yuojz2wow() {
|
|
|
2549
2559
|
column: undefined
|
|
2550
2560
|
}
|
|
2551
2561
|
}],
|
|
2552
|
-
line:
|
|
2562
|
+
line: 143
|
|
2553
2563
|
},
|
|
2554
2564
|
"35": {
|
|
2555
2565
|
loc: {
|
|
2556
2566
|
start: {
|
|
2557
|
-
line:
|
|
2567
|
+
line: 143,
|
|
2558
2568
|
column: 12
|
|
2559
2569
|
},
|
|
2560
2570
|
end: {
|
|
2561
|
-
line:
|
|
2571
|
+
line: 143,
|
|
2562
2572
|
column: 162
|
|
2563
2573
|
}
|
|
2564
2574
|
},
|
|
2565
2575
|
type: "binary-expr",
|
|
2566
2576
|
locations: [{
|
|
2567
2577
|
start: {
|
|
2568
|
-
line:
|
|
2578
|
+
line: 143,
|
|
2569
2579
|
column: 13
|
|
2570
2580
|
},
|
|
2571
2581
|
end: {
|
|
2572
|
-
line:
|
|
2582
|
+
line: 143,
|
|
2573
2583
|
column: 84
|
|
2574
2584
|
}
|
|
2575
2585
|
}, {
|
|
2576
2586
|
start: {
|
|
2577
|
-
line:
|
|
2587
|
+
line: 143,
|
|
2578
2588
|
column: 90
|
|
2579
2589
|
},
|
|
2580
2590
|
end: {
|
|
2581
|
-
line:
|
|
2591
|
+
line: 143,
|
|
2582
2592
|
column: 161
|
|
2583
2593
|
}
|
|
2584
2594
|
}],
|
|
2585
|
-
line:
|
|
2595
|
+
line: 143
|
|
2586
2596
|
},
|
|
2587
2597
|
"36": {
|
|
2588
2598
|
loc: {
|
|
2589
2599
|
start: {
|
|
2590
|
-
line:
|
|
2600
|
+
line: 143,
|
|
2591
2601
|
column: 13
|
|
2592
2602
|
},
|
|
2593
2603
|
end: {
|
|
2594
|
-
line:
|
|
2604
|
+
line: 143,
|
|
2595
2605
|
column: 84
|
|
2596
2606
|
}
|
|
2597
2607
|
},
|
|
2598
2608
|
type: "cond-expr",
|
|
2599
2609
|
locations: [{
|
|
2600
2610
|
start: {
|
|
2601
|
-
line:
|
|
2611
|
+
line: 143,
|
|
2602
2612
|
column: 54
|
|
2603
2613
|
},
|
|
2604
2614
|
end: {
|
|
2605
|
-
line:
|
|
2615
|
+
line: 143,
|
|
2606
2616
|
column: 60
|
|
2607
2617
|
}
|
|
2608
2618
|
}, {
|
|
2609
2619
|
start: {
|
|
2610
|
-
line:
|
|
2620
|
+
line: 143,
|
|
2611
2621
|
column: 63
|
|
2612
2622
|
},
|
|
2613
2623
|
end: {
|
|
2614
|
-
line:
|
|
2624
|
+
line: 143,
|
|
2615
2625
|
column: 84
|
|
2616
2626
|
}
|
|
2617
2627
|
}],
|
|
2618
|
-
line:
|
|
2628
|
+
line: 143
|
|
2619
2629
|
},
|
|
2620
2630
|
"37": {
|
|
2621
2631
|
loc: {
|
|
2622
2632
|
start: {
|
|
2623
|
-
line:
|
|
2633
|
+
line: 143,
|
|
2624
2634
|
column: 13
|
|
2625
2635
|
},
|
|
2626
2636
|
end: {
|
|
2627
|
-
line:
|
|
2637
|
+
line: 143,
|
|
2628
2638
|
column: 51
|
|
2629
2639
|
}
|
|
2630
2640
|
},
|
|
2631
2641
|
type: "binary-expr",
|
|
2632
2642
|
locations: [{
|
|
2633
2643
|
start: {
|
|
2634
|
-
line:
|
|
2644
|
+
line: 143,
|
|
2635
2645
|
column: 13
|
|
2636
2646
|
},
|
|
2637
2647
|
end: {
|
|
2638
|
-
line:
|
|
2648
|
+
line: 143,
|
|
2639
2649
|
column: 29
|
|
2640
2650
|
}
|
|
2641
2651
|
}, {
|
|
2642
2652
|
start: {
|
|
2643
|
-
line:
|
|
2653
|
+
line: 143,
|
|
2644
2654
|
column: 33
|
|
2645
2655
|
},
|
|
2646
2656
|
end: {
|
|
2647
|
-
line:
|
|
2657
|
+
line: 143,
|
|
2648
2658
|
column: 51
|
|
2649
2659
|
}
|
|
2650
2660
|
}],
|
|
2651
|
-
line:
|
|
2661
|
+
line: 143
|
|
2652
2662
|
},
|
|
2653
2663
|
"38": {
|
|
2654
2664
|
loc: {
|
|
2655
2665
|
start: {
|
|
2656
|
-
line:
|
|
2666
|
+
line: 143,
|
|
2657
2667
|
column: 90
|
|
2658
2668
|
},
|
|
2659
2669
|
end: {
|
|
2660
|
-
line:
|
|
2670
|
+
line: 143,
|
|
2661
2671
|
column: 161
|
|
2662
2672
|
}
|
|
2663
2673
|
},
|
|
2664
2674
|
type: "cond-expr",
|
|
2665
2675
|
locations: [{
|
|
2666
2676
|
start: {
|
|
2667
|
-
line:
|
|
2677
|
+
line: 143,
|
|
2668
2678
|
column: 131
|
|
2669
2679
|
},
|
|
2670
2680
|
end: {
|
|
2671
|
-
line:
|
|
2681
|
+
line: 143,
|
|
2672
2682
|
column: 137
|
|
2673
2683
|
}
|
|
2674
2684
|
}, {
|
|
2675
2685
|
start: {
|
|
2676
|
-
line:
|
|
2686
|
+
line: 143,
|
|
2677
2687
|
column: 140
|
|
2678
2688
|
},
|
|
2679
2689
|
end: {
|
|
2680
|
-
line:
|
|
2690
|
+
line: 143,
|
|
2681
2691
|
column: 161
|
|
2682
2692
|
}
|
|
2683
2693
|
}],
|
|
2684
|
-
line:
|
|
2694
|
+
line: 143
|
|
2685
2695
|
},
|
|
2686
2696
|
"39": {
|
|
2687
2697
|
loc: {
|
|
2688
2698
|
start: {
|
|
2689
|
-
line:
|
|
2699
|
+
line: 143,
|
|
2690
2700
|
column: 90
|
|
2691
2701
|
},
|
|
2692
2702
|
end: {
|
|
2693
|
-
line:
|
|
2703
|
+
line: 143,
|
|
2694
2704
|
column: 128
|
|
2695
2705
|
}
|
|
2696
2706
|
},
|
|
2697
2707
|
type: "binary-expr",
|
|
2698
2708
|
locations: [{
|
|
2699
2709
|
start: {
|
|
2700
|
-
line:
|
|
2710
|
+
line: 143,
|
|
2701
2711
|
column: 90
|
|
2702
2712
|
},
|
|
2703
2713
|
end: {
|
|
2704
|
-
line:
|
|
2714
|
+
line: 143,
|
|
2705
2715
|
column: 106
|
|
2706
2716
|
}
|
|
2707
2717
|
}, {
|
|
2708
2718
|
start: {
|
|
2709
|
-
line:
|
|
2719
|
+
line: 143,
|
|
2710
2720
|
column: 110
|
|
2711
2721
|
},
|
|
2712
2722
|
end: {
|
|
2713
|
-
line:
|
|
2723
|
+
line: 143,
|
|
2714
2724
|
column: 128
|
|
2715
2725
|
}
|
|
2716
2726
|
}],
|
|
2717
|
-
line:
|
|
2727
|
+
line: 143
|
|
2718
2728
|
},
|
|
2719
2729
|
"40": {
|
|
2720
2730
|
loc: {
|
|
2721
2731
|
start: {
|
|
2722
|
-
line:
|
|
2732
|
+
line: 152,
|
|
2723
2733
|
column: 8
|
|
2724
2734
|
},
|
|
2725
2735
|
end: {
|
|
2726
|
-
line:
|
|
2736
|
+
line: 153,
|
|
2727
2737
|
column: 60
|
|
2728
2738
|
}
|
|
2729
2739
|
},
|
|
2730
2740
|
type: "if",
|
|
2731
2741
|
locations: [{
|
|
2732
2742
|
start: {
|
|
2733
|
-
line:
|
|
2743
|
+
line: 152,
|
|
2734
2744
|
column: 8
|
|
2735
2745
|
},
|
|
2736
2746
|
end: {
|
|
2737
|
-
line:
|
|
2747
|
+
line: 153,
|
|
2738
2748
|
column: 60
|
|
2739
2749
|
}
|
|
2740
2750
|
}, {
|
|
@@ -2747,27 +2757,27 @@ function cov_yuojz2wow() {
|
|
|
2747
2757
|
column: undefined
|
|
2748
2758
|
}
|
|
2749
2759
|
}],
|
|
2750
|
-
line:
|
|
2760
|
+
line: 152
|
|
2751
2761
|
},
|
|
2752
2762
|
"41": {
|
|
2753
2763
|
loc: {
|
|
2754
2764
|
start: {
|
|
2755
|
-
line:
|
|
2765
|
+
line: 181,
|
|
2756
2766
|
column: 8
|
|
2757
2767
|
},
|
|
2758
2768
|
end: {
|
|
2759
|
-
line:
|
|
2769
|
+
line: 182,
|
|
2760
2770
|
column: 28
|
|
2761
2771
|
}
|
|
2762
2772
|
},
|
|
2763
2773
|
type: "if",
|
|
2764
2774
|
locations: [{
|
|
2765
2775
|
start: {
|
|
2766
|
-
line:
|
|
2776
|
+
line: 181,
|
|
2767
2777
|
column: 8
|
|
2768
2778
|
},
|
|
2769
2779
|
end: {
|
|
2770
|
-
line:
|
|
2780
|
+
line: 182,
|
|
2771
2781
|
column: 28
|
|
2772
2782
|
}
|
|
2773
2783
|
}, {
|
|
@@ -2780,27 +2790,27 @@ function cov_yuojz2wow() {
|
|
|
2780
2790
|
column: undefined
|
|
2781
2791
|
}
|
|
2782
2792
|
}],
|
|
2783
|
-
line:
|
|
2793
|
+
line: 181
|
|
2784
2794
|
},
|
|
2785
2795
|
"42": {
|
|
2786
2796
|
loc: {
|
|
2787
2797
|
start: {
|
|
2788
|
-
line:
|
|
2798
|
+
line: 186,
|
|
2789
2799
|
column: 16
|
|
2790
2800
|
},
|
|
2791
2801
|
end: {
|
|
2792
|
-
line:
|
|
2802
|
+
line: 187,
|
|
2793
2803
|
column: 37
|
|
2794
2804
|
}
|
|
2795
2805
|
},
|
|
2796
2806
|
type: "if",
|
|
2797
2807
|
locations: [{
|
|
2798
2808
|
start: {
|
|
2799
|
-
line:
|
|
2809
|
+
line: 186,
|
|
2800
2810
|
column: 16
|
|
2801
2811
|
},
|
|
2802
2812
|
end: {
|
|
2803
|
-
line:
|
|
2813
|
+
line: 187,
|
|
2804
2814
|
column: 37
|
|
2805
2815
|
}
|
|
2806
2816
|
}, {
|
|
@@ -2813,27 +2823,27 @@ function cov_yuojz2wow() {
|
|
|
2813
2823
|
column: undefined
|
|
2814
2824
|
}
|
|
2815
2825
|
}],
|
|
2816
|
-
line:
|
|
2826
|
+
line: 186
|
|
2817
2827
|
},
|
|
2818
2828
|
"43": {
|
|
2819
2829
|
loc: {
|
|
2820
2830
|
start: {
|
|
2821
|
-
line:
|
|
2831
|
+
line: 196,
|
|
2822
2832
|
column: 24
|
|
2823
2833
|
},
|
|
2824
2834
|
end: {
|
|
2825
|
-
line:
|
|
2835
|
+
line: 197,
|
|
2826
2836
|
column: 102
|
|
2827
2837
|
}
|
|
2828
2838
|
},
|
|
2829
2839
|
type: "if",
|
|
2830
2840
|
locations: [{
|
|
2831
2841
|
start: {
|
|
2832
|
-
line:
|
|
2842
|
+
line: 196,
|
|
2833
2843
|
column: 24
|
|
2834
2844
|
},
|
|
2835
2845
|
end: {
|
|
2836
|
-
line:
|
|
2846
|
+
line: 197,
|
|
2837
2847
|
column: 102
|
|
2838
2848
|
}
|
|
2839
2849
|
}, {
|
|
@@ -2846,27 +2856,27 @@ function cov_yuojz2wow() {
|
|
|
2846
2856
|
column: undefined
|
|
2847
2857
|
}
|
|
2848
2858
|
}],
|
|
2849
|
-
line:
|
|
2859
|
+
line: 196
|
|
2850
2860
|
},
|
|
2851
2861
|
"44": {
|
|
2852
2862
|
loc: {
|
|
2853
2863
|
start: {
|
|
2854
|
-
line:
|
|
2864
|
+
line: 204,
|
|
2855
2865
|
column: 16
|
|
2856
2866
|
},
|
|
2857
2867
|
end: {
|
|
2858
|
-
line:
|
|
2868
|
+
line: 205,
|
|
2859
2869
|
column: 113
|
|
2860
2870
|
}
|
|
2861
2871
|
},
|
|
2862
2872
|
type: "if",
|
|
2863
2873
|
locations: [{
|
|
2864
2874
|
start: {
|
|
2865
|
-
line:
|
|
2875
|
+
line: 204,
|
|
2866
2876
|
column: 16
|
|
2867
2877
|
},
|
|
2868
2878
|
end: {
|
|
2869
|
-
line:
|
|
2879
|
+
line: 205,
|
|
2870
2880
|
column: 113
|
|
2871
2881
|
}
|
|
2872
2882
|
}, {
|
|
@@ -2879,27 +2889,27 @@ function cov_yuojz2wow() {
|
|
|
2879
2889
|
column: undefined
|
|
2880
2890
|
}
|
|
2881
2891
|
}],
|
|
2882
|
-
line:
|
|
2892
|
+
line: 204
|
|
2883
2893
|
},
|
|
2884
2894
|
"45": {
|
|
2885
2895
|
loc: {
|
|
2886
2896
|
start: {
|
|
2887
|
-
line:
|
|
2897
|
+
line: 225,
|
|
2888
2898
|
column: 12
|
|
2889
2899
|
},
|
|
2890
2900
|
end: {
|
|
2891
|
-
line:
|
|
2901
|
+
line: 226,
|
|
2892
2902
|
column: 44
|
|
2893
2903
|
}
|
|
2894
2904
|
},
|
|
2895
2905
|
type: "if",
|
|
2896
2906
|
locations: [{
|
|
2897
2907
|
start: {
|
|
2898
|
-
line:
|
|
2908
|
+
line: 225,
|
|
2899
2909
|
column: 12
|
|
2900
2910
|
},
|
|
2901
2911
|
end: {
|
|
2902
|
-
line:
|
|
2912
|
+
line: 226,
|
|
2903
2913
|
column: 44
|
|
2904
2914
|
}
|
|
2905
2915
|
}, {
|
|
@@ -2912,7 +2922,7 @@ function cov_yuojz2wow() {
|
|
|
2912
2922
|
column: undefined
|
|
2913
2923
|
}
|
|
2914
2924
|
}],
|
|
2915
|
-
line:
|
|
2925
|
+
line: 225
|
|
2916
2926
|
}
|
|
2917
2927
|
},
|
|
2918
2928
|
s: {
|
|
@@ -2998,7 +3008,8 @@ function cov_yuojz2wow() {
|
|
|
2998
3008
|
"79": 0,
|
|
2999
3009
|
"80": 0,
|
|
3000
3010
|
"81": 0,
|
|
3001
|
-
"82": 0
|
|
3011
|
+
"82": 0,
|
|
3012
|
+
"83": 0
|
|
3002
3013
|
},
|
|
3003
3014
|
f: {
|
|
3004
3015
|
"0": 0,
|
|
@@ -3075,13 +3086,13 @@ function cov_yuojz2wow() {
|
|
|
3075
3086
|
inputSourceMap: {
|
|
3076
3087
|
version: 3,
|
|
3077
3088
|
file: "ITwinLocalization.js",
|
|
3078
|
-
sources: ["D:\\
|
|
3089
|
+
sources: ["D:\\vsts_a\\1\\s\\core\\i18n\\src\\ITwinLocalization.ts"],
|
|
3079
3090
|
names: [],
|
|
3080
|
-
mappings: "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
|
|
3081
|
-
sourcesContent: ["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module Localization\r\n */\r\n\r\nimport i18next, { i18n, InitOptions, Module, TOptionsBase } from \"i18next\";\r\nimport i18nextBrowserLanguageDetector, { DetectorOptions } from \"i18next-browser-languagedetector\";\r\nimport Backend, { BackendOptions } from \"i18next-http-backend\";\r\nimport { Logger } from \"@itwin/core-bentley\";\r\nimport type { Localization } from \"@itwin/core-common\";\r\n\r\nconst DEFAULT_MAX_RETRIES: number = 1; // a low number prevents wasted time and potential timeouts when requesting localization files throws an error\r\n\r\n/** Options for ITwinLocalization\r\n * @public\r\n */\r\nexport interface LocalizationOptions {\r\n urlTemplate?: string;\r\n backendPlugin?: Module;\r\n detectorPlugin?: Module;\r\n initOptions?: InitOptions;\r\n backendHttpOptions?: BackendOptions;\r\n detectorOptions?: DetectorOptions;\r\n}\r\n\r\n/** Supplies localizations for iTwin.js\r\n * @note this class uses the [i18next](https://www.i18next.com/) package.\r\n * @public\r\n */\r\nexport class ITwinLocalization implements Localization {\r\n public i18next: i18n;\r\n private readonly _initOptions: InitOptions;\r\n private readonly _backendOptions: BackendOptions;\r\n private readonly _detectionOptions: DetectorOptions;\r\n private readonly _namespaces = new Map<string, Promise<void>>();\r\n\r\n public constructor(options?: LocalizationOptions) {\r\n this.i18next = i18next.createInstance();\r\n\r\n this._backendOptions = {\r\n loadPath: options?.urlTemplate ?? \"locales/{{lng}}/{{ns}}.json\",\r\n crossDomain: true,\r\n ...options?.backendHttpOptions,\r\n };\r\n\r\n this._detectionOptions = {\r\n order: [\"querystring\", \"navigator\", \"htmlTag\"],\r\n lookupQuerystring: \"lng\",\r\n caches: [],\r\n ...options?.detectorOptions,\r\n };\r\n\r\n this._initOptions = {\r\n interpolation: { escapeValue: true },\r\n fallbackLng: \"en\",\r\n maxRetries: DEFAULT_MAX_RETRIES,\r\n backend: this._backendOptions,\r\n detection: this._detectionOptions,\r\n ...options?.initOptions,\r\n };\r\n\r\n this.i18next\r\n .use(options?.detectorPlugin ?? i18nextBrowserLanguageDetector)\r\n .use(options?.backendPlugin ?? Backend)\r\n .use(TranslationLogger);\r\n }\r\n\r\n public async initialize(namespaces: string[]): Promise<void> {\r\n\r\n // Also consider namespaces passed into constructor\r\n const initNamespaces: string[] = [this._initOptions.ns || []].flat();\r\n const combinedNamespaces: Set<string> = new Set([...namespaces, ...initNamespaces]); // without duplicates\r\n\r\n const defaultNamespace: string | false | readonly string[] = this._initOptions.defaultNS ?? namespaces[0];\r\n if (defaultNamespace)\r\n combinedNamespaces.add(defaultNamespace as string); // Make sure default namespace is in namespaces list\r\n\r\n const initOptions: InitOptions = {\r\n ...this._initOptions,\r\n defaultNS: defaultNamespace,\r\n ns: [...combinedNamespaces],\r\n };\r\n\r\n // if in a development environment, set debugging\r\n if (process.env.NODE_ENV === \"development\")\r\n initOptions.debug = true;\r\n\r\n const initPromise = this.i18next.init(initOptions) as unknown as Promise<void>;\r\n\r\n for (const ns of namespaces)\r\n this._namespaces.set(ns, initPromise);\r\n\r\n return initPromise;\r\n }\r\n\r\n /** Replace all instances of `%{key}` within a string with the translations of those keys.\r\n * For example:\r\n * ``` ts\r\n * \"MyKeys\": {\r\n * \"Key1\": \"First value\",\r\n * \"Key2\": \"Second value\"\r\n * }\r\n * ```\r\n *\r\n * ``` ts\r\n * i18.translateKeys(\"string with %{MyKeys.Key1} followed by %{MyKeys.Key2}!\"\") // returns \"string with First Value followed by Second Value!\"\r\n * ```\r\n * @param line The input line, potentially containing %{keys}.\r\n * @returns The line with all %{keys} translated\r\n * @public\r\n */\r\n public getLocalizedKeys(line: string): string {\r\n return line.replace(/\\%\\{(.+?)\\}/g, (_match, tag) => this.getLocalizedString(tag));\r\n }\r\n\r\n /** Return the translated value of a key.\r\n * @param key - the key that matches a property in the JSON localization file.\r\n * @note The key includes the namespace, which identifies the particular localization file that contains the property,\r\n * followed by a colon, followed by the property in the JSON file.\r\n * For example:\r\n * ``` ts\r\n * const dataString: string = IModelApp.localization.getLocalizedString(\"iModelJs:BackgroundMap.BingDataAttribution\");\r\n * ```\r\n * assigns to dataString the string with property BackgroundMap.BingDataAttribution from the iModelJs.json localization file.\r\n * @returns The string corresponding to the first key that resolves.\r\n * @throws Error if no keys resolve to a string.\r\n * @public\r\n */\r\n public getLocalizedString(key: string | string[], options?: TOptionsBase): string {\r\n if (options?.returnDetails || options?.returnObjects) {\r\n throw new Error(\"Translation key must map to a string, but the given options will result in an object\");\r\n }\r\n\r\n const value = this.i18next.t(key, options);\r\n\r\n if (typeof value !== \"string\") {\r\n throw new Error(\"Translation key(s) string not found\");\r\n }\r\n\r\n return value;\r\n }\r\n\r\n /** Similar to `getLocalizedString` but the namespace is a separate param and the key does not include the namespace.\r\n * @param namespace - the namespace that identifies the particular localization file that contains the property.\r\n * @param key - the key that matches a property in the JSON localization file.\r\n * @returns The string corresponding to the first key that resolves.\r\n * @throws Error if no keys resolve to a string.\r\n * @internal\r\n */\r\n public getLocalizedStringWithNamespace(namespace: string, key: string | string[], options?: TOptionsBase): string {\r\n let fullKey: string | string[] = \"\";\r\n\r\n if (typeof key === \"string\") {\r\n fullKey = `${namespace}:${key}`;\r\n } else {\r\n fullKey = key.map((subKey: string) => {\r\n return `${namespace}:${subKey}`;\r\n });\r\n }\r\n\r\n return this.getLocalizedString(fullKey, options);\r\n }\r\n\r\n /** Gets the English translation.\r\n * @param namespace - the namespace that identifies the particular localization file that contains the property.\r\n * @param key - the key that matches a property in the JSON localization file.\r\n * @returns The string corresponding to the first key that resolves.\r\n * @throws Error if no keys resolve to a string.\r\n * @internal\r\n */\r\n public getEnglishString(namespace: string, key: string | string[], options?: TOptionsBase): string {\r\n if (options?.returnDetails || options?.returnObjects) {\r\n throw new Error(\"Translation key must map to a string, but the given options will result in an object\");\r\n }\r\n\r\n const en = this.i18next.getFixedT(\"en\", namespace);\r\n const str = en(key, options);\r\n if (typeof str !== \"string\")\r\n throw new Error(\"Translation key(s) not found\");\r\n\r\n return str;\r\n }\r\n\r\n /** Get the promise for an already registered Namespace.\r\n * @param name - the name of the namespace\r\n * @public\r\n */\r\n public getNamespacePromise(name: string): Promise<void> | undefined {\r\n return this._namespaces.get(name);\r\n }\r\n\r\n /** @internal */\r\n public getLanguageList(): readonly string[] {\r\n return this.i18next.languages;\r\n }\r\n\r\n /** override the language detected in the browser */\r\n public async changeLanguage(language: string) {\r\n return this.i18next.changeLanguage(language) as unknown as Promise<void>;\r\n }\r\n\r\n /** Register a new Namespace and return it. If the namespace is already registered, it will be returned.\r\n * @param name - the name of the namespace, which is the base name of the JSON file that contains the localization properties.\r\n * @note - The registerNamespace method starts fetching the appropriate version of the JSON localization file from the server,\r\n * based on the current locale. To make sure that fetch is complete before performing translations from this namespace, await\r\n * fulfillment of the readPromise Promise property of the returned LocalizationNamespace.\r\n * @see [Localization in iTwin.js]($docs/learning/frontend/Localization.md)\r\n * @public\r\n */\r\n public async registerNamespace(name: string): Promise<void> {\r\n const existing = this._namespaces.get(name);\r\n if (existing !== undefined)\r\n return existing;\r\n\r\n const theReadPromise = new Promise<void>((resolve) => {\r\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\r\n this.i18next.loadNamespaces(name, (err) => {\r\n if (!err)\r\n return resolve();\r\n\r\n // Here we got a non-null err object.\r\n // This method is called when the system has attempted to load the resources for the namespaces for each possible locale.\r\n // For example 'fr-ca' might be the most specific locale, in which case 'fr' and 'en' are fallback locales.\r\n // Using Backend from i18next-http-backend, err will be an array of strings of each namespace it tried to read and its locale.\r\n // There might be errs for some other namespaces as well as this one. We resolve the promise unless there's an error for each possible locale.\r\n let locales = this.getLanguageList().map((thisLocale: any) => `/${thisLocale}/`);\r\n\r\n try {\r\n for (const thisError of err) {\r\n if (typeof thisError === \"string\")\r\n locales = locales.filter((thisLocale) => !thisError.includes(thisLocale));\r\n }\r\n } catch (e) {\r\n locales = [];\r\n }\r\n // if we removed every locale from the array, it wasn't loaded.\r\n if (locales.length === 0)\r\n Logger.logError(\"i18n\", `No resources for namespace ${name} could be loaded`);\r\n\r\n resolve();\r\n });\r\n });\r\n this._namespaces.set(name, theReadPromise);\r\n return theReadPromise;\r\n }\r\n\r\n /** @internal */\r\n public unregisterNamespace(name: string): void {\r\n this._namespaces.delete(name);\r\n }\r\n}\r\n\r\nclass TranslationLogger {\r\n public static readonly type = \"logger\";\r\n public log(args: string[]) { Logger.logInfo(\"i18n\", this.createLogMessage(args)); }\r\n public warn(args: string[]) { Logger.logWarning(\"i18n\", this.createLogMessage(args)); }\r\n public error(args: string[]) { Logger.logError(\"i18n\", this.createLogMessage(args)); }\r\n private createLogMessage(args: string[]) {\r\n let message = args[0];\r\n for (let i = 1; i < args.length; ++i) {\r\n if (typeof args[i] === \"string\")\r\n message += `\\n ${args[i]}`;\r\n }\r\n return message;\r\n }\r\n}\r\n"]
|
|
3091
|
+
mappings: "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",
|
|
3092
|
+
sourcesContent: ["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module Localization\r\n */\r\n\r\nimport i18next, { i18n, InitOptions, Module, TOptionsBase } from \"i18next\";\r\nimport i18nextBrowserLanguageDetector, { DetectorOptions } from \"i18next-browser-languagedetector\";\r\nimport Backend, { BackendOptions } from \"i18next-http-backend\";\r\nimport { Logger } from \"@itwin/core-bentley\";\r\nimport type { Localization } from \"@itwin/core-common\";\r\n\r\nconst DEFAULT_MAX_RETRIES: number = 1; // a low number prevents wasted time and potential timeouts when requesting localization files throws an error\r\n\r\n/** Options for ITwinLocalization\r\n * @public\r\n */\r\nexport interface LocalizationOptions {\r\n urlTemplate?: string;\r\n backendPlugin?: Module;\r\n detectorPlugin?: Module;\r\n initOptions?: InitOptions;\r\n backendHttpOptions?: BackendOptions;\r\n detectorOptions?: DetectorOptions;\r\n}\r\n\r\n/** Supplies localizations for iTwin.js\r\n * @note this class uses the [i18next](https://www.i18next.com/) package.\r\n * @public\r\n */\r\nexport class ITwinLocalization implements Localization {\r\n public i18next: i18n;\r\n private readonly _initOptions: InitOptions;\r\n private readonly _backendOptions: BackendOptions;\r\n private readonly _detectionOptions: DetectorOptions;\r\n private readonly _namespaces = new Map<string, Promise<void>>();\r\n\r\n public constructor(options?: LocalizationOptions) {\r\n this.i18next = i18next.createInstance();\r\n\r\n this._backendOptions = {\r\n loadPath: options?.urlTemplate ?? \"locales/{{lng}}/{{ns}}.json\",\r\n crossDomain: true,\r\n ...options?.backendHttpOptions,\r\n };\r\n\r\n this._detectionOptions = {\r\n order: [\"querystring\", \"navigator\", \"htmlTag\"],\r\n lookupQuerystring: \"lng\",\r\n caches: [],\r\n ...options?.detectorOptions,\r\n };\r\n\r\n this._initOptions = {\r\n interpolation: { escapeValue: true },\r\n fallbackLng: \"en\",\r\n maxRetries: DEFAULT_MAX_RETRIES,\r\n backend: this._backendOptions,\r\n detection: this._detectionOptions,\r\n ...options?.initOptions,\r\n };\r\n\r\n this.i18next\r\n .use(options?.detectorPlugin ?? i18nextBrowserLanguageDetector)\r\n .use(options?.backendPlugin ?? Backend)\r\n .use(TranslationLogger);\r\n }\r\n\r\n public async initialize(namespaces: string[]): Promise<void> {\r\n\r\n // Also consider namespaces passed into constructor\r\n const initNamespaces: string[] = [this._initOptions.ns || []].flat();\r\n const combinedNamespaces: Set<string> = new Set([...namespaces, ...initNamespaces]); // without duplicates\r\n\r\n const defaultNamespace: string | false | readonly string[] = this._initOptions.defaultNS ?? namespaces[0];\r\n if (defaultNamespace)\r\n combinedNamespaces.add(defaultNamespace as string); // Make sure default namespace is in namespaces list\r\n\r\n const initOptions: InitOptions = {\r\n ...this._initOptions,\r\n defaultNS: defaultNamespace,\r\n ns: [...combinedNamespaces],\r\n };\r\n\r\n // if in a development environment, set debugging\r\n if (process.env.NODE_ENV === \"development\")\r\n initOptions.debug = true;\r\n\r\n const initPromise = this.i18next.init(initOptions) as unknown as Promise<void>;\r\n\r\n for (const ns of namespaces)\r\n this._namespaces.set(ns, initPromise);\r\n\r\n return initPromise;\r\n }\r\n\r\n /** Replace all instances of `%{key}` within a string with the translations of those keys.\r\n * For example:\r\n * ``` ts\r\n * \"MyKeys\": {\r\n * \"Key1\": \"First value\",\r\n * \"Key2\": \"Second value\"\r\n * }\r\n * ```\r\n *\r\n * ``` ts\r\n * i18.translateKeys(\"string with %{MyKeys.Key1} followed by %{MyKeys.Key2}!\"\") // returns \"string with First Value followed by Second Value!\"\r\n * ```\r\n * @param line The input line, potentially containing %{keys}.\r\n * @returns The line with all %{keys} translated\r\n * @public\r\n */\r\n public getLocalizedKeys(line: string): string {\r\n return line.replace(/\\%\\{(.+?)\\}/g, (_match, tag) => this.getLocalizedString(tag));\r\n }\r\n\r\n /** Return the translated value of a key.\r\n * @param key - the key that matches a property in the JSON localization file.\r\n * @note The key includes the namespace, which identifies the particular localization file that contains the property,\r\n * followed by a colon, followed by the property in the JSON file.\r\n * For example:\r\n * ``` ts\r\n * const dataString: string = IModelApp.localization.getLocalizedString(\"iModelJs:BackgroundMap.BingDataAttribution\");\r\n * ```\r\n * assigns to dataString the string with property BackgroundMap.BingDataAttribution from the iModelJs.json localization file.\r\n * @returns The string corresponding to the first key that resolves.\r\n * @throws Error if no keys resolve to a string.\r\n * @public\r\n */\r\n public getLocalizedString(key: string | string[], options?: TOptionsBase): string {\r\n if (options?.returnDetails || options?.returnObjects) {\r\n throw new Error(\"Translation key must map to a string, but the given options will result in an object\");\r\n }\r\n\r\n const value = this.i18next.t(key, options);\r\n\r\n if (typeof value !== \"string\") {\r\n throw new Error(\"Translation key(s) string not found\");\r\n }\r\n\r\n return value;\r\n }\r\n\r\n /** Similar to `getLocalizedString` but the default namespace is a separate parameter and the key does not need\r\n * to include a namespace. If a key includes a namespace, that namespace will be used for interpolating that key.\r\n * @param namespace - the namespace that identifies the particular localization file that contains the property.\r\n * @param key - the key that matches a property in the JSON localization file.\r\n * @returns The string corresponding to the first key that resolves.\r\n * @throws Error if no keys resolve to a string.\r\n * @internal\r\n */\r\n public getLocalizedStringWithNamespace(namespace: string, key: string | string[], options?: TOptionsBase): string {\r\n let fullKey: string | string[] = \"\";\r\n\r\n if (typeof key === \"string\") {\r\n fullKey = `${namespace}:${key}`;\r\n } else {\r\n fullKey = key.map((subKey: string) => {\r\n return `${namespace}:${subKey}`;\r\n });\r\n }\r\n\r\n return this.getLocalizedString(fullKey, options);\r\n }\r\n\r\n /** Gets the English translation.\r\n * @param namespace - the namespace that identifies the particular localization file that contains the property.\r\n * @param key - the key that matches a property in the JSON localization file.\r\n * @returns The string corresponding to the first key that resolves.\r\n * @throws Error if no keys resolve to a string.\r\n * @internal\r\n */\r\n public getEnglishString(namespace: string, key: string | string[], options?: TOptionsBase): string {\r\n if (options?.returnDetails || options?.returnObjects) {\r\n throw new Error(\"Translation key must map to a string, but the given options will result in an object\");\r\n }\r\n\r\n options = {\r\n ...options,\r\n ns: namespace, // ensure namespace argument is used\r\n };\r\n\r\n const en = this.i18next.getFixedT(\"en\", namespace);\r\n const str = en(key, options);\r\n if (typeof str !== \"string\")\r\n throw new Error(\"Translation key(s) not found\");\r\n\r\n return str;\r\n }\r\n\r\n /** Get the promise for an already registered Namespace.\r\n * @param name - the name of the namespace\r\n * @public\r\n */\r\n public getNamespacePromise(name: string): Promise<void> | undefined {\r\n return this._namespaces.get(name);\r\n }\r\n\r\n /** @internal */\r\n public getLanguageList(): readonly string[] {\r\n return this.i18next.languages;\r\n }\r\n\r\n /** override the language detected in the browser */\r\n public async changeLanguage(language: string) {\r\n return this.i18next.changeLanguage(language) as unknown as Promise<void>;\r\n }\r\n\r\n /** Register a new Namespace and return it. If the namespace is already registered, it will be returned.\r\n * @param name - the name of the namespace, which is the base name of the JSON file that contains the localization properties.\r\n * @note - The registerNamespace method starts fetching the appropriate version of the JSON localization file from the server,\r\n * based on the current locale. To make sure that fetch is complete before performing translations from this namespace, await\r\n * fulfillment of the readPromise Promise property of the returned LocalizationNamespace.\r\n * @see [Localization in iTwin.js]($docs/learning/frontend/Localization.md)\r\n * @public\r\n */\r\n public async registerNamespace(name: string): Promise<void> {\r\n const existing = this._namespaces.get(name);\r\n if (existing !== undefined)\r\n return existing;\r\n\r\n const theReadPromise = new Promise<void>((resolve) => {\r\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\r\n this.i18next.loadNamespaces(name, (err) => {\r\n if (!err)\r\n return resolve();\r\n\r\n // Here we got a non-null err object.\r\n // This method is called when the system has attempted to load the resources for the namespaces for each possible locale.\r\n // For example 'fr-ca' might be the most specific locale, in which case 'fr' and 'en' are fallback locales.\r\n // Using Backend from i18next-http-backend, err will be an array of strings of each namespace it tried to read and its locale.\r\n // There might be errs for some other namespaces as well as this one. We resolve the promise unless there's an error for each possible locale.\r\n let locales = this.getLanguageList().map((thisLocale: any) => `/${thisLocale}/`);\r\n\r\n try {\r\n for (const thisError of err) {\r\n if (typeof thisError === \"string\")\r\n locales = locales.filter((thisLocale) => !thisError.includes(thisLocale));\r\n }\r\n } catch (e) {\r\n locales = [];\r\n }\r\n // if we removed every locale from the array, it wasn't loaded.\r\n if (locales.length === 0)\r\n Logger.logError(\"i18n\", `No resources for namespace ${name} could be loaded`);\r\n\r\n resolve();\r\n });\r\n });\r\n this._namespaces.set(name, theReadPromise);\r\n return theReadPromise;\r\n }\r\n\r\n /** @internal */\r\n public unregisterNamespace(name: string): void {\r\n this._namespaces.delete(name);\r\n }\r\n}\r\n\r\nclass TranslationLogger {\r\n public static readonly type = \"logger\";\r\n public log(args: string[]) { Logger.logInfo(\"i18n\", this.createLogMessage(args)); }\r\n public warn(args: string[]) { Logger.logWarning(\"i18n\", this.createLogMessage(args)); }\r\n public error(args: string[]) { Logger.logError(\"i18n\", this.createLogMessage(args)); }\r\n private createLogMessage(args: string[]) {\r\n let message = args[0];\r\n for (let i = 1; i < args.length; ++i) {\r\n if (typeof args[i] === \"string\")\r\n message += `\\n ${args[i]}`;\r\n }\r\n return message;\r\n }\r\n}\r\n"]
|
|
3082
3093
|
},
|
|
3083
3094
|
_coverageSchema: "1a1c01bbd47fc00a2c39e90264f33305004495a9",
|
|
3084
|
-
hash: "
|
|
3095
|
+
hash: "7e07cc3560d3d5f83d31338f926e741c63e5de79"
|
|
3085
3096
|
};
|
|
3086
3097
|
var coverage = global[gcv] || (global[gcv] = {});
|
|
3087
3098
|
if (!coverage[path] || coverage[path].hash !== hash) {
|
|
@@ -3090,57 +3101,57 @@ function cov_yuojz2wow() {
|
|
|
3090
3101
|
var actualCoverage = coverage[path];
|
|
3091
3102
|
{
|
|
3092
3103
|
// @ts-ignore
|
|
3093
|
-
|
|
3104
|
+
cov_29ajiy3676 = function () {
|
|
3094
3105
|
return actualCoverage;
|
|
3095
3106
|
};
|
|
3096
3107
|
}
|
|
3097
3108
|
return actualCoverage;
|
|
3098
3109
|
}
|
|
3099
|
-
|
|
3100
|
-
var __importDefault = (
|
|
3101
|
-
|
|
3102
|
-
|
|
3103
|
-
return (
|
|
3110
|
+
cov_29ajiy3676();
|
|
3111
|
+
var __importDefault = (cov_29ajiy3676().s[0]++, (cov_29ajiy3676().b[0][0]++, this) && (cov_29ajiy3676().b[0][1]++, this.__importDefault) || (cov_29ajiy3676().b[0][2]++, function (mod) {
|
|
3112
|
+
cov_29ajiy3676().f[0]++;
|
|
3113
|
+
cov_29ajiy3676().s[1]++;
|
|
3114
|
+
return (cov_29ajiy3676().b[2][0]++, mod) && (cov_29ajiy3676().b[2][1]++, mod.__esModule) ? (cov_29ajiy3676().b[1][0]++, mod) : (cov_29ajiy3676().b[1][1]++, {
|
|
3104
3115
|
"default": mod
|
|
3105
3116
|
});
|
|
3106
3117
|
}));
|
|
3107
|
-
|
|
3118
|
+
cov_29ajiy3676().s[2]++;
|
|
3108
3119
|
Object.defineProperty(exports, "__esModule", ({
|
|
3109
3120
|
value: true
|
|
3110
3121
|
}));
|
|
3111
|
-
|
|
3122
|
+
cov_29ajiy3676().s[3]++;
|
|
3112
3123
|
exports.ITwinLocalization = void 0;
|
|
3113
|
-
const i18next_1 = (
|
|
3114
|
-
const i18next_browser_languagedetector_1 = (
|
|
3115
|
-
const i18next_http_backend_1 = (
|
|
3116
|
-
const core_bentley_1 = (
|
|
3117
|
-
const DEFAULT_MAX_RETRIES = (
|
|
3124
|
+
const i18next_1 = (cov_29ajiy3676().s[4]++, __importDefault(__webpack_require__(/*! i18next */ "../../common/temp/node_modules/.pnpm/i18next@21.10.0/node_modules/i18next/dist/cjs/i18next.js")));
|
|
3125
|
+
const i18next_browser_languagedetector_1 = (cov_29ajiy3676().s[5]++, __importDefault(__webpack_require__(/*! i18next-browser-languagedetector */ "../../common/temp/node_modules/.pnpm/i18next-browser-languagedetector@6.1.8/node_modules/i18next-browser-languagedetector/dist/cjs/i18nextBrowserLanguageDetector.js")));
|
|
3126
|
+
const i18next_http_backend_1 = (cov_29ajiy3676().s[6]++, __importDefault(__webpack_require__(/*! i18next-http-backend */ "../../common/temp/node_modules/.pnpm/i18next-http-backend@1.4.5/node_modules/i18next-http-backend/cjs/index.js")));
|
|
3127
|
+
const core_bentley_1 = (cov_29ajiy3676().s[7]++, __webpack_require__(/*! @itwin/core-bentley */ "../bentley/lib/esm/core-bentley.js"));
|
|
3128
|
+
const DEFAULT_MAX_RETRIES = (cov_29ajiy3676().s[8]++, 1); // a low number prevents wasted time and potential timeouts when requesting localization files throws an error
|
|
3118
3129
|
/** Supplies localizations for iTwin.js
|
|
3119
3130
|
* @note this class uses the [i18next](https://www.i18next.com/) package.
|
|
3120
3131
|
* @public
|
|
3121
3132
|
*/
|
|
3122
3133
|
class ITwinLocalization {
|
|
3123
3134
|
constructor(options) {
|
|
3124
|
-
|
|
3135
|
+
cov_29ajiy3676().f[1]++;
|
|
3125
3136
|
var _a, _b, _c;
|
|
3126
|
-
|
|
3137
|
+
cov_29ajiy3676().s[9]++;
|
|
3127
3138
|
this._namespaces = new Map();
|
|
3128
|
-
|
|
3139
|
+
cov_29ajiy3676().s[10]++;
|
|
3129
3140
|
this.i18next = i18next_1.default.createInstance();
|
|
3130
|
-
|
|
3141
|
+
cov_29ajiy3676().s[11]++;
|
|
3131
3142
|
this._backendOptions = {
|
|
3132
|
-
loadPath: (
|
|
3143
|
+
loadPath: (cov_29ajiy3676().b[4][0]++, (_a = (cov_29ajiy3676().b[6][0]++, options === null) || (cov_29ajiy3676().b[6][1]++, options === void 0) ? (cov_29ajiy3676().b[5][0]++, void 0) : (cov_29ajiy3676().b[5][1]++, options.urlTemplate)) !== null) && (cov_29ajiy3676().b[4][1]++, _a !== void 0) ? (cov_29ajiy3676().b[3][0]++, _a) : (cov_29ajiy3676().b[3][1]++, "locales/{{lng}}/{{ns}}.json"),
|
|
3133
3144
|
crossDomain: true,
|
|
3134
|
-
...((
|
|
3145
|
+
...((cov_29ajiy3676().b[8][0]++, options === null) || (cov_29ajiy3676().b[8][1]++, options === void 0) ? (cov_29ajiy3676().b[7][0]++, void 0) : (cov_29ajiy3676().b[7][1]++, options.backendHttpOptions))
|
|
3135
3146
|
};
|
|
3136
|
-
|
|
3147
|
+
cov_29ajiy3676().s[12]++;
|
|
3137
3148
|
this._detectionOptions = {
|
|
3138
3149
|
order: ["querystring", "navigator", "htmlTag"],
|
|
3139
3150
|
lookupQuerystring: "lng",
|
|
3140
3151
|
caches: [],
|
|
3141
|
-
...((
|
|
3152
|
+
...((cov_29ajiy3676().b[10][0]++, options === null) || (cov_29ajiy3676().b[10][1]++, options === void 0) ? (cov_29ajiy3676().b[9][0]++, void 0) : (cov_29ajiy3676().b[9][1]++, options.detectorOptions))
|
|
3142
3153
|
};
|
|
3143
|
-
|
|
3154
|
+
cov_29ajiy3676().s[13]++;
|
|
3144
3155
|
this._initOptions = {
|
|
3145
3156
|
interpolation: {
|
|
3146
3157
|
escapeValue: true
|
|
@@ -3149,43 +3160,43 @@ class ITwinLocalization {
|
|
|
3149
3160
|
maxRetries: DEFAULT_MAX_RETRIES,
|
|
3150
3161
|
backend: this._backendOptions,
|
|
3151
3162
|
detection: this._detectionOptions,
|
|
3152
|
-
...((
|
|
3163
|
+
...((cov_29ajiy3676().b[12][0]++, options === null) || (cov_29ajiy3676().b[12][1]++, options === void 0) ? (cov_29ajiy3676().b[11][0]++, void 0) : (cov_29ajiy3676().b[11][1]++, options.initOptions))
|
|
3153
3164
|
};
|
|
3154
|
-
|
|
3155
|
-
this.i18next.use((
|
|
3165
|
+
cov_29ajiy3676().s[14]++;
|
|
3166
|
+
this.i18next.use((cov_29ajiy3676().b[14][0]++, (_b = (cov_29ajiy3676().b[16][0]++, options === null) || (cov_29ajiy3676().b[16][1]++, options === void 0) ? (cov_29ajiy3676().b[15][0]++, void 0) : (cov_29ajiy3676().b[15][1]++, options.detectorPlugin)) !== null) && (cov_29ajiy3676().b[14][1]++, _b !== void 0) ? (cov_29ajiy3676().b[13][0]++, _b) : (cov_29ajiy3676().b[13][1]++, i18next_browser_languagedetector_1.default)).use((cov_29ajiy3676().b[18][0]++, (_c = (cov_29ajiy3676().b[20][0]++, options === null) || (cov_29ajiy3676().b[20][1]++, options === void 0) ? (cov_29ajiy3676().b[19][0]++, void 0) : (cov_29ajiy3676().b[19][1]++, options.backendPlugin)) !== null) && (cov_29ajiy3676().b[18][1]++, _c !== void 0) ? (cov_29ajiy3676().b[17][0]++, _c) : (cov_29ajiy3676().b[17][1]++, i18next_http_backend_1.default)).use(TranslationLogger);
|
|
3156
3167
|
}
|
|
3157
3168
|
async initialize(namespaces) {
|
|
3158
|
-
|
|
3169
|
+
cov_29ajiy3676().f[2]++;
|
|
3159
3170
|
var _a;
|
|
3160
3171
|
// Also consider namespaces passed into constructor
|
|
3161
|
-
const initNamespaces = (
|
|
3162
|
-
const combinedNamespaces = (
|
|
3163
|
-
const defaultNamespace = (
|
|
3164
|
-
|
|
3172
|
+
const initNamespaces = (cov_29ajiy3676().s[15]++, [(cov_29ajiy3676().b[21][0]++, this._initOptions.ns) || (cov_29ajiy3676().b[21][1]++, [])].flat());
|
|
3173
|
+
const combinedNamespaces = (cov_29ajiy3676().s[16]++, new Set([...namespaces, ...initNamespaces])); // without duplicates
|
|
3174
|
+
const defaultNamespace = (cov_29ajiy3676().s[17]++, (cov_29ajiy3676().b[23][0]++, (_a = this._initOptions.defaultNS) !== null) && (cov_29ajiy3676().b[23][1]++, _a !== void 0) ? (cov_29ajiy3676().b[22][0]++, _a) : (cov_29ajiy3676().b[22][1]++, namespaces[0]));
|
|
3175
|
+
cov_29ajiy3676().s[18]++;
|
|
3165
3176
|
if (defaultNamespace) {
|
|
3166
|
-
|
|
3167
|
-
|
|
3177
|
+
cov_29ajiy3676().b[24][0]++;
|
|
3178
|
+
cov_29ajiy3676().s[19]++;
|
|
3168
3179
|
combinedNamespaces.add(defaultNamespace);
|
|
3169
3180
|
} else {
|
|
3170
|
-
|
|
3181
|
+
cov_29ajiy3676().b[24][1]++;
|
|
3171
3182
|
} // Make sure default namespace is in namespaces list
|
|
3172
|
-
const initOptions = (
|
|
3183
|
+
const initOptions = (cov_29ajiy3676().s[20]++, {
|
|
3173
3184
|
...this._initOptions,
|
|
3174
3185
|
defaultNS: defaultNamespace,
|
|
3175
3186
|
ns: [...combinedNamespaces]
|
|
3176
3187
|
});
|
|
3177
3188
|
// if in a development environment, set debugging
|
|
3178
|
-
|
|
3189
|
+
cov_29ajiy3676().s[21]++;
|
|
3179
3190
|
if (false) {} else {
|
|
3180
|
-
|
|
3191
|
+
cov_29ajiy3676().b[25][1]++;
|
|
3181
3192
|
}
|
|
3182
|
-
const initPromise = (
|
|
3183
|
-
|
|
3193
|
+
const initPromise = (cov_29ajiy3676().s[23]++, this.i18next.init(initOptions));
|
|
3194
|
+
cov_29ajiy3676().s[24]++;
|
|
3184
3195
|
for (const ns of namespaces) {
|
|
3185
|
-
|
|
3196
|
+
cov_29ajiy3676().s[25]++;
|
|
3186
3197
|
this._namespaces.set(ns, initPromise);
|
|
3187
3198
|
}
|
|
3188
|
-
|
|
3199
|
+
cov_29ajiy3676().s[26]++;
|
|
3189
3200
|
return initPromise;
|
|
3190
3201
|
}
|
|
3191
3202
|
/** Replace all instances of `%{key}` within a string with the translations of those keys.
|
|
@@ -3205,11 +3216,11 @@ class ITwinLocalization {
|
|
|
3205
3216
|
* @public
|
|
3206
3217
|
*/
|
|
3207
3218
|
getLocalizedKeys(line) {
|
|
3208
|
-
|
|
3209
|
-
|
|
3219
|
+
cov_29ajiy3676().f[3]++;
|
|
3220
|
+
cov_29ajiy3676().s[27]++;
|
|
3210
3221
|
return line.replace(/\%\{(.+?)\}/g, (_match, tag) => {
|
|
3211
|
-
|
|
3212
|
-
|
|
3222
|
+
cov_29ajiy3676().f[4]++;
|
|
3223
|
+
cov_29ajiy3676().s[28]++;
|
|
3213
3224
|
return this.getLocalizedString(tag);
|
|
3214
3225
|
});
|
|
3215
3226
|
}
|
|
@@ -3227,28 +3238,29 @@ class ITwinLocalization {
|
|
|
3227
3238
|
* @public
|
|
3228
3239
|
*/
|
|
3229
3240
|
getLocalizedString(key, options) {
|
|
3230
|
-
|
|
3231
|
-
|
|
3232
|
-
if ((
|
|
3233
|
-
|
|
3234
|
-
|
|
3241
|
+
cov_29ajiy3676().f[5]++;
|
|
3242
|
+
cov_29ajiy3676().s[29]++;
|
|
3243
|
+
if ((cov_29ajiy3676().b[27][0]++, (cov_29ajiy3676().b[29][0]++, options === null) || (cov_29ajiy3676().b[29][1]++, options === void 0) ? (cov_29ajiy3676().b[28][0]++, void 0) : (cov_29ajiy3676().b[28][1]++, options.returnDetails)) || (cov_29ajiy3676().b[27][1]++, (cov_29ajiy3676().b[31][0]++, options === null) || (cov_29ajiy3676().b[31][1]++, options === void 0) ? (cov_29ajiy3676().b[30][0]++, void 0) : (cov_29ajiy3676().b[30][1]++, options.returnObjects))) {
|
|
3244
|
+
cov_29ajiy3676().b[26][0]++;
|
|
3245
|
+
cov_29ajiy3676().s[30]++;
|
|
3235
3246
|
throw new Error("Translation key must map to a string, but the given options will result in an object");
|
|
3236
3247
|
} else {
|
|
3237
|
-
|
|
3248
|
+
cov_29ajiy3676().b[26][1]++;
|
|
3238
3249
|
}
|
|
3239
|
-
const value = (
|
|
3240
|
-
|
|
3250
|
+
const value = (cov_29ajiy3676().s[31]++, this.i18next.t(key, options));
|
|
3251
|
+
cov_29ajiy3676().s[32]++;
|
|
3241
3252
|
if (typeof value !== "string") {
|
|
3242
|
-
|
|
3243
|
-
|
|
3253
|
+
cov_29ajiy3676().b[32][0]++;
|
|
3254
|
+
cov_29ajiy3676().s[33]++;
|
|
3244
3255
|
throw new Error("Translation key(s) string not found");
|
|
3245
3256
|
} else {
|
|
3246
|
-
|
|
3257
|
+
cov_29ajiy3676().b[32][1]++;
|
|
3247
3258
|
}
|
|
3248
|
-
|
|
3259
|
+
cov_29ajiy3676().s[34]++;
|
|
3249
3260
|
return value;
|
|
3250
3261
|
}
|
|
3251
|
-
/** Similar to `getLocalizedString` but the namespace is a separate
|
|
3262
|
+
/** Similar to `getLocalizedString` but the default namespace is a separate parameter and the key does not need
|
|
3263
|
+
* to include a namespace. If a key includes a namespace, that namespace will be used for interpolating that key.
|
|
3252
3264
|
* @param namespace - the namespace that identifies the particular localization file that contains the property.
|
|
3253
3265
|
* @param key - the key that matches a property in the JSON localization file.
|
|
3254
3266
|
* @returns The string corresponding to the first key that resolves.
|
|
@@ -3256,23 +3268,23 @@ class ITwinLocalization {
|
|
|
3256
3268
|
* @internal
|
|
3257
3269
|
*/
|
|
3258
3270
|
getLocalizedStringWithNamespace(namespace, key, options) {
|
|
3259
|
-
|
|
3260
|
-
let fullKey = (
|
|
3261
|
-
|
|
3271
|
+
cov_29ajiy3676().f[6]++;
|
|
3272
|
+
let fullKey = (cov_29ajiy3676().s[35]++, "");
|
|
3273
|
+
cov_29ajiy3676().s[36]++;
|
|
3262
3274
|
if (typeof key === "string") {
|
|
3263
|
-
|
|
3264
|
-
|
|
3275
|
+
cov_29ajiy3676().b[33][0]++;
|
|
3276
|
+
cov_29ajiy3676().s[37]++;
|
|
3265
3277
|
fullKey = `${namespace}:${key}`;
|
|
3266
3278
|
} else {
|
|
3267
|
-
|
|
3268
|
-
|
|
3279
|
+
cov_29ajiy3676().b[33][1]++;
|
|
3280
|
+
cov_29ajiy3676().s[38]++;
|
|
3269
3281
|
fullKey = key.map(subKey => {
|
|
3270
|
-
|
|
3271
|
-
|
|
3282
|
+
cov_29ajiy3676().f[7]++;
|
|
3283
|
+
cov_29ajiy3676().s[39]++;
|
|
3272
3284
|
return `${namespace}:${subKey}`;
|
|
3273
3285
|
});
|
|
3274
3286
|
}
|
|
3275
|
-
|
|
3287
|
+
cov_29ajiy3676().s[40]++;
|
|
3276
3288
|
return this.getLocalizedString(fullKey, options);
|
|
3277
3289
|
}
|
|
3278
3290
|
/** Gets the English translation.
|
|
@@ -3283,26 +3295,32 @@ class ITwinLocalization {
|
|
|
3283
3295
|
* @internal
|
|
3284
3296
|
*/
|
|
3285
3297
|
getEnglishString(namespace, key, options) {
|
|
3286
|
-
|
|
3287
|
-
|
|
3288
|
-
if ((
|
|
3289
|
-
|
|
3290
|
-
|
|
3298
|
+
cov_29ajiy3676().f[8]++;
|
|
3299
|
+
cov_29ajiy3676().s[41]++;
|
|
3300
|
+
if ((cov_29ajiy3676().b[35][0]++, (cov_29ajiy3676().b[37][0]++, options === null) || (cov_29ajiy3676().b[37][1]++, options === void 0) ? (cov_29ajiy3676().b[36][0]++, void 0) : (cov_29ajiy3676().b[36][1]++, options.returnDetails)) || (cov_29ajiy3676().b[35][1]++, (cov_29ajiy3676().b[39][0]++, options === null) || (cov_29ajiy3676().b[39][1]++, options === void 0) ? (cov_29ajiy3676().b[38][0]++, void 0) : (cov_29ajiy3676().b[38][1]++, options.returnObjects))) {
|
|
3301
|
+
cov_29ajiy3676().b[34][0]++;
|
|
3302
|
+
cov_29ajiy3676().s[42]++;
|
|
3291
3303
|
throw new Error("Translation key must map to a string, but the given options will result in an object");
|
|
3292
3304
|
} else {
|
|
3293
|
-
|
|
3305
|
+
cov_29ajiy3676().b[34][1]++;
|
|
3294
3306
|
}
|
|
3295
|
-
|
|
3296
|
-
|
|
3297
|
-
|
|
3307
|
+
cov_29ajiy3676().s[43]++;
|
|
3308
|
+
options = {
|
|
3309
|
+
...options,
|
|
3310
|
+
ns: namespace // ensure namespace argument is used
|
|
3311
|
+
};
|
|
3312
|
+
|
|
3313
|
+
const en = (cov_29ajiy3676().s[44]++, this.i18next.getFixedT("en", namespace));
|
|
3314
|
+
const str = (cov_29ajiy3676().s[45]++, en(key, options));
|
|
3315
|
+
cov_29ajiy3676().s[46]++;
|
|
3298
3316
|
if (typeof str !== "string") {
|
|
3299
|
-
|
|
3300
|
-
|
|
3317
|
+
cov_29ajiy3676().b[40][0]++;
|
|
3318
|
+
cov_29ajiy3676().s[47]++;
|
|
3301
3319
|
throw new Error("Translation key(s) not found");
|
|
3302
3320
|
} else {
|
|
3303
|
-
|
|
3321
|
+
cov_29ajiy3676().b[40][1]++;
|
|
3304
3322
|
}
|
|
3305
|
-
|
|
3323
|
+
cov_29ajiy3676().s[48]++;
|
|
3306
3324
|
return str;
|
|
3307
3325
|
}
|
|
3308
3326
|
/** Get the promise for an already registered Namespace.
|
|
@@ -3310,20 +3328,20 @@ class ITwinLocalization {
|
|
|
3310
3328
|
* @public
|
|
3311
3329
|
*/
|
|
3312
3330
|
getNamespacePromise(name) {
|
|
3313
|
-
|
|
3314
|
-
|
|
3331
|
+
cov_29ajiy3676().f[9]++;
|
|
3332
|
+
cov_29ajiy3676().s[49]++;
|
|
3315
3333
|
return this._namespaces.get(name);
|
|
3316
3334
|
}
|
|
3317
3335
|
/** @internal */
|
|
3318
3336
|
getLanguageList() {
|
|
3319
|
-
|
|
3320
|
-
|
|
3337
|
+
cov_29ajiy3676().f[10]++;
|
|
3338
|
+
cov_29ajiy3676().s[50]++;
|
|
3321
3339
|
return this.i18next.languages;
|
|
3322
3340
|
}
|
|
3323
3341
|
/** override the language detected in the browser */
|
|
3324
3342
|
async changeLanguage(language) {
|
|
3325
|
-
|
|
3326
|
-
|
|
3343
|
+
cov_29ajiy3676().f[11]++;
|
|
3344
|
+
cov_29ajiy3676().s[51]++;
|
|
3327
3345
|
return this.i18next.changeLanguage(language);
|
|
3328
3346
|
}
|
|
3329
3347
|
/** Register a new Namespace and return it. If the namespace is already registered, it will be returned.
|
|
@@ -3335,123 +3353,123 @@ class ITwinLocalization {
|
|
|
3335
3353
|
* @public
|
|
3336
3354
|
*/
|
|
3337
3355
|
async registerNamespace(name) {
|
|
3338
|
-
|
|
3339
|
-
const existing = (
|
|
3340
|
-
|
|
3356
|
+
cov_29ajiy3676().f[12]++;
|
|
3357
|
+
const existing = (cov_29ajiy3676().s[52]++, this._namespaces.get(name));
|
|
3358
|
+
cov_29ajiy3676().s[53]++;
|
|
3341
3359
|
if (existing !== undefined) {
|
|
3342
|
-
|
|
3343
|
-
|
|
3360
|
+
cov_29ajiy3676().b[41][0]++;
|
|
3361
|
+
cov_29ajiy3676().s[54]++;
|
|
3344
3362
|
return existing;
|
|
3345
3363
|
} else {
|
|
3346
|
-
|
|
3364
|
+
cov_29ajiy3676().b[41][1]++;
|
|
3347
3365
|
}
|
|
3348
|
-
const theReadPromise = (
|
|
3349
|
-
|
|
3350
|
-
|
|
3366
|
+
const theReadPromise = (cov_29ajiy3676().s[55]++, new Promise(resolve => {
|
|
3367
|
+
cov_29ajiy3676().f[13]++;
|
|
3368
|
+
cov_29ajiy3676().s[56]++;
|
|
3351
3369
|
// eslint-disable-next-line @typescript-eslint/no-floating-promises
|
|
3352
3370
|
this.i18next.loadNamespaces(name, err => {
|
|
3353
|
-
|
|
3354
|
-
|
|
3371
|
+
cov_29ajiy3676().f[14]++;
|
|
3372
|
+
cov_29ajiy3676().s[57]++;
|
|
3355
3373
|
if (!err) {
|
|
3356
|
-
|
|
3357
|
-
|
|
3374
|
+
cov_29ajiy3676().b[42][0]++;
|
|
3375
|
+
cov_29ajiy3676().s[58]++;
|
|
3358
3376
|
return resolve();
|
|
3359
3377
|
} else {
|
|
3360
|
-
|
|
3378
|
+
cov_29ajiy3676().b[42][1]++;
|
|
3361
3379
|
}
|
|
3362
3380
|
// Here we got a non-null err object.
|
|
3363
3381
|
// This method is called when the system has attempted to load the resources for the namespaces for each possible locale.
|
|
3364
3382
|
// For example 'fr-ca' might be the most specific locale, in which case 'fr' and 'en' are fallback locales.
|
|
3365
3383
|
// Using Backend from i18next-http-backend, err will be an array of strings of each namespace it tried to read and its locale.
|
|
3366
3384
|
// There might be errs for some other namespaces as well as this one. We resolve the promise unless there's an error for each possible locale.
|
|
3367
|
-
let locales = (
|
|
3368
|
-
|
|
3369
|
-
|
|
3385
|
+
let locales = (cov_29ajiy3676().s[59]++, this.getLanguageList().map(thisLocale => {
|
|
3386
|
+
cov_29ajiy3676().f[15]++;
|
|
3387
|
+
cov_29ajiy3676().s[60]++;
|
|
3370
3388
|
return `/${thisLocale}/`;
|
|
3371
3389
|
}));
|
|
3372
|
-
|
|
3390
|
+
cov_29ajiy3676().s[61]++;
|
|
3373
3391
|
try {
|
|
3374
|
-
|
|
3392
|
+
cov_29ajiy3676().s[62]++;
|
|
3375
3393
|
for (const thisError of err) {
|
|
3376
|
-
|
|
3394
|
+
cov_29ajiy3676().s[63]++;
|
|
3377
3395
|
if (typeof thisError === "string") {
|
|
3378
|
-
|
|
3379
|
-
|
|
3396
|
+
cov_29ajiy3676().b[43][0]++;
|
|
3397
|
+
cov_29ajiy3676().s[64]++;
|
|
3380
3398
|
locales = locales.filter(thisLocale => {
|
|
3381
|
-
|
|
3382
|
-
|
|
3399
|
+
cov_29ajiy3676().f[16]++;
|
|
3400
|
+
cov_29ajiy3676().s[65]++;
|
|
3383
3401
|
return !thisError.includes(thisLocale);
|
|
3384
3402
|
});
|
|
3385
3403
|
} else {
|
|
3386
|
-
|
|
3404
|
+
cov_29ajiy3676().b[43][1]++;
|
|
3387
3405
|
}
|
|
3388
3406
|
}
|
|
3389
3407
|
} catch (e) {
|
|
3390
|
-
|
|
3408
|
+
cov_29ajiy3676().s[66]++;
|
|
3391
3409
|
locales = [];
|
|
3392
3410
|
}
|
|
3393
3411
|
// if we removed every locale from the array, it wasn't loaded.
|
|
3394
|
-
|
|
3412
|
+
cov_29ajiy3676().s[67]++;
|
|
3395
3413
|
if (locales.length === 0) {
|
|
3396
|
-
|
|
3397
|
-
|
|
3414
|
+
cov_29ajiy3676().b[44][0]++;
|
|
3415
|
+
cov_29ajiy3676().s[68]++;
|
|
3398
3416
|
core_bentley_1.Logger.logError("i18n", `No resources for namespace ${name} could be loaded`);
|
|
3399
3417
|
} else {
|
|
3400
|
-
|
|
3418
|
+
cov_29ajiy3676().b[44][1]++;
|
|
3401
3419
|
}
|
|
3402
|
-
|
|
3420
|
+
cov_29ajiy3676().s[69]++;
|
|
3403
3421
|
resolve();
|
|
3404
3422
|
});
|
|
3405
3423
|
}));
|
|
3406
|
-
|
|
3424
|
+
cov_29ajiy3676().s[70]++;
|
|
3407
3425
|
this._namespaces.set(name, theReadPromise);
|
|
3408
|
-
|
|
3426
|
+
cov_29ajiy3676().s[71]++;
|
|
3409
3427
|
return theReadPromise;
|
|
3410
3428
|
}
|
|
3411
3429
|
/** @internal */
|
|
3412
3430
|
unregisterNamespace(name) {
|
|
3413
|
-
|
|
3414
|
-
|
|
3431
|
+
cov_29ajiy3676().f[17]++;
|
|
3432
|
+
cov_29ajiy3676().s[72]++;
|
|
3415
3433
|
this._namespaces.delete(name);
|
|
3416
3434
|
}
|
|
3417
3435
|
}
|
|
3418
|
-
|
|
3436
|
+
cov_29ajiy3676().s[73]++;
|
|
3419
3437
|
exports.ITwinLocalization = ITwinLocalization;
|
|
3420
3438
|
class TranslationLogger {
|
|
3421
3439
|
log(args) {
|
|
3422
|
-
|
|
3423
|
-
|
|
3440
|
+
cov_29ajiy3676().f[18]++;
|
|
3441
|
+
cov_29ajiy3676().s[74]++;
|
|
3424
3442
|
core_bentley_1.Logger.logInfo("i18n", this.createLogMessage(args));
|
|
3425
3443
|
}
|
|
3426
3444
|
warn(args) {
|
|
3427
|
-
|
|
3428
|
-
|
|
3445
|
+
cov_29ajiy3676().f[19]++;
|
|
3446
|
+
cov_29ajiy3676().s[75]++;
|
|
3429
3447
|
core_bentley_1.Logger.logWarning("i18n", this.createLogMessage(args));
|
|
3430
3448
|
}
|
|
3431
3449
|
error(args) {
|
|
3432
|
-
|
|
3433
|
-
|
|
3450
|
+
cov_29ajiy3676().f[20]++;
|
|
3451
|
+
cov_29ajiy3676().s[76]++;
|
|
3434
3452
|
core_bentley_1.Logger.logError("i18n", this.createLogMessage(args));
|
|
3435
3453
|
}
|
|
3436
3454
|
createLogMessage(args) {
|
|
3437
|
-
|
|
3438
|
-
let message = (
|
|
3439
|
-
|
|
3440
|
-
for (let i = (
|
|
3441
|
-
|
|
3455
|
+
cov_29ajiy3676().f[21]++;
|
|
3456
|
+
let message = (cov_29ajiy3676().s[77]++, args[0]);
|
|
3457
|
+
cov_29ajiy3676().s[78]++;
|
|
3458
|
+
for (let i = (cov_29ajiy3676().s[79]++, 1); i < args.length; ++i) {
|
|
3459
|
+
cov_29ajiy3676().s[80]++;
|
|
3442
3460
|
if (typeof args[i] === "string") {
|
|
3443
|
-
|
|
3444
|
-
|
|
3461
|
+
cov_29ajiy3676().b[45][0]++;
|
|
3462
|
+
cov_29ajiy3676().s[81]++;
|
|
3445
3463
|
message += `\n ${args[i]}`;
|
|
3446
3464
|
} else {
|
|
3447
|
-
|
|
3465
|
+
cov_29ajiy3676().b[45][1]++;
|
|
3448
3466
|
}
|
|
3449
3467
|
}
|
|
3450
|
-
|
|
3468
|
+
cov_29ajiy3676().s[82]++;
|
|
3451
3469
|
return message;
|
|
3452
3470
|
}
|
|
3453
3471
|
}
|
|
3454
|
-
|
|
3472
|
+
cov_29ajiy3676().s[83]++;
|
|
3455
3473
|
TranslationLogger.type = "logger";
|
|
3456
3474
|
|
|
3457
3475
|
/***/ }),
|
|
@@ -14240,8 +14258,8 @@ module.exports = getFuncName;
|
|
|
14240
14258
|
"use strict";
|
|
14241
14259
|
|
|
14242
14260
|
|
|
14243
|
-
var _classCallCheck = __webpack_require__(/*! @babel/runtime/helpers/classCallCheck */ "../../common/temp/node_modules/.pnpm/@babel+runtime@7.
|
|
14244
|
-
var _createClass = __webpack_require__(/*! @babel/runtime/helpers/createClass */ "../../common/temp/node_modules/.pnpm/@babel+runtime@7.
|
|
14261
|
+
var _classCallCheck = __webpack_require__(/*! @babel/runtime/helpers/classCallCheck */ "../../common/temp/node_modules/.pnpm/@babel+runtime@7.19.4/node_modules/@babel/runtime/helpers/classCallCheck.js");
|
|
14262
|
+
var _createClass = __webpack_require__(/*! @babel/runtime/helpers/createClass */ "../../common/temp/node_modules/.pnpm/@babel+runtime@7.19.4/node_modules/@babel/runtime/helpers/createClass.js");
|
|
14245
14263
|
|
|
14246
14264
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
14247
14265
|
|
|
@@ -14673,15 +14691,15 @@ module.exports = Browser;
|
|
|
14673
14691
|
"use strict";
|
|
14674
14692
|
|
|
14675
14693
|
|
|
14676
|
-
var _typeof = __webpack_require__(/*! @babel/runtime/helpers/typeof */ "../../common/temp/node_modules/.pnpm/@babel+runtime@7.
|
|
14677
|
-
var _classCallCheck = __webpack_require__(/*! @babel/runtime/helpers/classCallCheck */ "../../common/temp/node_modules/.pnpm/@babel+runtime@7.
|
|
14678
|
-
var _createClass = __webpack_require__(/*! @babel/runtime/helpers/createClass */ "../../common/temp/node_modules/.pnpm/@babel+runtime@7.
|
|
14679
|
-
var _assertThisInitialized = __webpack_require__(/*! @babel/runtime/helpers/assertThisInitialized */ "../../common/temp/node_modules/.pnpm/@babel+runtime@7.
|
|
14680
|
-
var _inherits = __webpack_require__(/*! @babel/runtime/helpers/inherits */ "../../common/temp/node_modules/.pnpm/@babel+runtime@7.
|
|
14681
|
-
var _possibleConstructorReturn = __webpack_require__(/*! @babel/runtime/helpers/possibleConstructorReturn */ "../../common/temp/node_modules/.pnpm/@babel+runtime@7.
|
|
14682
|
-
var _getPrototypeOf = __webpack_require__(/*! @babel/runtime/helpers/getPrototypeOf */ "../../common/temp/node_modules/.pnpm/@babel+runtime@7.
|
|
14683
|
-
var _defineProperty = __webpack_require__(/*! @babel/runtime/helpers/defineProperty */ "../../common/temp/node_modules/.pnpm/@babel+runtime@7.
|
|
14684
|
-
var _toArray = __webpack_require__(/*! @babel/runtime/helpers/toArray */ "../../common/temp/node_modules/.pnpm/@babel+runtime@7.
|
|
14694
|
+
var _typeof = __webpack_require__(/*! @babel/runtime/helpers/typeof */ "../../common/temp/node_modules/.pnpm/@babel+runtime@7.19.4/node_modules/@babel/runtime/helpers/typeof.js");
|
|
14695
|
+
var _classCallCheck = __webpack_require__(/*! @babel/runtime/helpers/classCallCheck */ "../../common/temp/node_modules/.pnpm/@babel+runtime@7.19.4/node_modules/@babel/runtime/helpers/classCallCheck.js");
|
|
14696
|
+
var _createClass = __webpack_require__(/*! @babel/runtime/helpers/createClass */ "../../common/temp/node_modules/.pnpm/@babel+runtime@7.19.4/node_modules/@babel/runtime/helpers/createClass.js");
|
|
14697
|
+
var _assertThisInitialized = __webpack_require__(/*! @babel/runtime/helpers/assertThisInitialized */ "../../common/temp/node_modules/.pnpm/@babel+runtime@7.19.4/node_modules/@babel/runtime/helpers/assertThisInitialized.js");
|
|
14698
|
+
var _inherits = __webpack_require__(/*! @babel/runtime/helpers/inherits */ "../../common/temp/node_modules/.pnpm/@babel+runtime@7.19.4/node_modules/@babel/runtime/helpers/inherits.js");
|
|
14699
|
+
var _possibleConstructorReturn = __webpack_require__(/*! @babel/runtime/helpers/possibleConstructorReturn */ "../../common/temp/node_modules/.pnpm/@babel+runtime@7.19.4/node_modules/@babel/runtime/helpers/possibleConstructorReturn.js");
|
|
14700
|
+
var _getPrototypeOf = __webpack_require__(/*! @babel/runtime/helpers/getPrototypeOf */ "../../common/temp/node_modules/.pnpm/@babel+runtime@7.19.4/node_modules/@babel/runtime/helpers/getPrototypeOf.js");
|
|
14701
|
+
var _defineProperty = __webpack_require__(/*! @babel/runtime/helpers/defineProperty */ "../../common/temp/node_modules/.pnpm/@babel+runtime@7.19.4/node_modules/@babel/runtime/helpers/defineProperty.js");
|
|
14702
|
+
var _toArray = __webpack_require__(/*! @babel/runtime/helpers/toArray */ "../../common/temp/node_modules/.pnpm/@babel+runtime@7.19.4/node_modules/@babel/runtime/helpers/toArray.js");
|
|
14685
14703
|
|
|
14686
14704
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
14687
14705
|
|
|
@@ -25652,9 +25670,9 @@ function partitionArray(array, criterion) {
|
|
|
25652
25670
|
|
|
25653
25671
|
/***/ }),
|
|
25654
25672
|
|
|
25655
|
-
/***/ "../../common/temp/node_modules/.pnpm/@babel+runtime@7.
|
|
25673
|
+
/***/ "../../common/temp/node_modules/.pnpm/@babel+runtime@7.19.4/node_modules/@babel/runtime/helpers/arrayLikeToArray.js":
|
|
25656
25674
|
/*!**************************************************************************************************************************!*\
|
|
25657
|
-
!*** ../../common/temp/node_modules/.pnpm/@babel+runtime@7.
|
|
25675
|
+
!*** ../../common/temp/node_modules/.pnpm/@babel+runtime@7.19.4/node_modules/@babel/runtime/helpers/arrayLikeToArray.js ***!
|
|
25658
25676
|
\**************************************************************************************************************************/
|
|
25659
25677
|
/***/ ((module) => {
|
|
25660
25678
|
|
|
@@ -25669,9 +25687,9 @@ module.exports = _arrayLikeToArray, module.exports.__esModule = true, module.exp
|
|
|
25669
25687
|
|
|
25670
25688
|
/***/ }),
|
|
25671
25689
|
|
|
25672
|
-
/***/ "../../common/temp/node_modules/.pnpm/@babel+runtime@7.
|
|
25690
|
+
/***/ "../../common/temp/node_modules/.pnpm/@babel+runtime@7.19.4/node_modules/@babel/runtime/helpers/arrayWithHoles.js":
|
|
25673
25691
|
/*!************************************************************************************************************************!*\
|
|
25674
|
-
!*** ../../common/temp/node_modules/.pnpm/@babel+runtime@7.
|
|
25692
|
+
!*** ../../common/temp/node_modules/.pnpm/@babel+runtime@7.19.4/node_modules/@babel/runtime/helpers/arrayWithHoles.js ***!
|
|
25675
25693
|
\************************************************************************************************************************/
|
|
25676
25694
|
/***/ ((module) => {
|
|
25677
25695
|
|
|
@@ -25682,9 +25700,9 @@ module.exports = _arrayWithHoles, module.exports.__esModule = true, module.expor
|
|
|
25682
25700
|
|
|
25683
25701
|
/***/ }),
|
|
25684
25702
|
|
|
25685
|
-
/***/ "../../common/temp/node_modules/.pnpm/@babel+runtime@7.
|
|
25703
|
+
/***/ "../../common/temp/node_modules/.pnpm/@babel+runtime@7.19.4/node_modules/@babel/runtime/helpers/assertThisInitialized.js":
|
|
25686
25704
|
/*!*******************************************************************************************************************************!*\
|
|
25687
|
-
!*** ../../common/temp/node_modules/.pnpm/@babel+runtime@7.
|
|
25705
|
+
!*** ../../common/temp/node_modules/.pnpm/@babel+runtime@7.19.4/node_modules/@babel/runtime/helpers/assertThisInitialized.js ***!
|
|
25688
25706
|
\*******************************************************************************************************************************/
|
|
25689
25707
|
/***/ ((module) => {
|
|
25690
25708
|
|
|
@@ -25698,9 +25716,9 @@ module.exports = _assertThisInitialized, module.exports.__esModule = true, modul
|
|
|
25698
25716
|
|
|
25699
25717
|
/***/ }),
|
|
25700
25718
|
|
|
25701
|
-
/***/ "../../common/temp/node_modules/.pnpm/@babel+runtime@7.
|
|
25719
|
+
/***/ "../../common/temp/node_modules/.pnpm/@babel+runtime@7.19.4/node_modules/@babel/runtime/helpers/classCallCheck.js":
|
|
25702
25720
|
/*!************************************************************************************************************************!*\
|
|
25703
|
-
!*** ../../common/temp/node_modules/.pnpm/@babel+runtime@7.
|
|
25721
|
+
!*** ../../common/temp/node_modules/.pnpm/@babel+runtime@7.19.4/node_modules/@babel/runtime/helpers/classCallCheck.js ***!
|
|
25704
25722
|
\************************************************************************************************************************/
|
|
25705
25723
|
/***/ ((module) => {
|
|
25706
25724
|
|
|
@@ -25713,9 +25731,9 @@ module.exports = _classCallCheck, module.exports.__esModule = true, module.expor
|
|
|
25713
25731
|
|
|
25714
25732
|
/***/ }),
|
|
25715
25733
|
|
|
25716
|
-
/***/ "../../common/temp/node_modules/.pnpm/@babel+runtime@7.
|
|
25734
|
+
/***/ "../../common/temp/node_modules/.pnpm/@babel+runtime@7.19.4/node_modules/@babel/runtime/helpers/createClass.js":
|
|
25717
25735
|
/*!*********************************************************************************************************************!*\
|
|
25718
|
-
!*** ../../common/temp/node_modules/.pnpm/@babel+runtime@7.
|
|
25736
|
+
!*** ../../common/temp/node_modules/.pnpm/@babel+runtime@7.19.4/node_modules/@babel/runtime/helpers/createClass.js ***!
|
|
25719
25737
|
\*********************************************************************************************************************/
|
|
25720
25738
|
/***/ ((module) => {
|
|
25721
25739
|
|
|
@@ -25740,9 +25758,9 @@ module.exports = _createClass, module.exports.__esModule = true, module.exports[
|
|
|
25740
25758
|
|
|
25741
25759
|
/***/ }),
|
|
25742
25760
|
|
|
25743
|
-
/***/ "../../common/temp/node_modules/.pnpm/@babel+runtime@7.
|
|
25761
|
+
/***/ "../../common/temp/node_modules/.pnpm/@babel+runtime@7.19.4/node_modules/@babel/runtime/helpers/defineProperty.js":
|
|
25744
25762
|
/*!************************************************************************************************************************!*\
|
|
25745
|
-
!*** ../../common/temp/node_modules/.pnpm/@babel+runtime@7.
|
|
25763
|
+
!*** ../../common/temp/node_modules/.pnpm/@babel+runtime@7.19.4/node_modules/@babel/runtime/helpers/defineProperty.js ***!
|
|
25746
25764
|
\************************************************************************************************************************/
|
|
25747
25765
|
/***/ ((module) => {
|
|
25748
25766
|
|
|
@@ -25763,9 +25781,9 @@ module.exports = _defineProperty, module.exports.__esModule = true, module.expor
|
|
|
25763
25781
|
|
|
25764
25782
|
/***/ }),
|
|
25765
25783
|
|
|
25766
|
-
/***/ "../../common/temp/node_modules/.pnpm/@babel+runtime@7.
|
|
25784
|
+
/***/ "../../common/temp/node_modules/.pnpm/@babel+runtime@7.19.4/node_modules/@babel/runtime/helpers/getPrototypeOf.js":
|
|
25767
25785
|
/*!************************************************************************************************************************!*\
|
|
25768
|
-
!*** ../../common/temp/node_modules/.pnpm/@babel+runtime@7.
|
|
25786
|
+
!*** ../../common/temp/node_modules/.pnpm/@babel+runtime@7.19.4/node_modules/@babel/runtime/helpers/getPrototypeOf.js ***!
|
|
25769
25787
|
\************************************************************************************************************************/
|
|
25770
25788
|
/***/ ((module) => {
|
|
25771
25789
|
|
|
@@ -25779,13 +25797,13 @@ module.exports = _getPrototypeOf, module.exports.__esModule = true, module.expor
|
|
|
25779
25797
|
|
|
25780
25798
|
/***/ }),
|
|
25781
25799
|
|
|
25782
|
-
/***/ "../../common/temp/node_modules/.pnpm/@babel+runtime@7.
|
|
25800
|
+
/***/ "../../common/temp/node_modules/.pnpm/@babel+runtime@7.19.4/node_modules/@babel/runtime/helpers/inherits.js":
|
|
25783
25801
|
/*!******************************************************************************************************************!*\
|
|
25784
|
-
!*** ../../common/temp/node_modules/.pnpm/@babel+runtime@7.
|
|
25802
|
+
!*** ../../common/temp/node_modules/.pnpm/@babel+runtime@7.19.4/node_modules/@babel/runtime/helpers/inherits.js ***!
|
|
25785
25803
|
\******************************************************************************************************************/
|
|
25786
25804
|
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
|
25787
25805
|
|
|
25788
|
-
var setPrototypeOf = __webpack_require__(/*! ./setPrototypeOf.js */ "../../common/temp/node_modules/.pnpm/@babel+runtime@7.
|
|
25806
|
+
var setPrototypeOf = __webpack_require__(/*! ./setPrototypeOf.js */ "../../common/temp/node_modules/.pnpm/@babel+runtime@7.19.4/node_modules/@babel/runtime/helpers/setPrototypeOf.js");
|
|
25789
25807
|
function _inherits(subClass, superClass) {
|
|
25790
25808
|
if (typeof superClass !== "function" && superClass !== null) {
|
|
25791
25809
|
throw new TypeError("Super expression must either be null or a function");
|
|
@@ -25806,9 +25824,9 @@ module.exports = _inherits, module.exports.__esModule = true, module.exports["de
|
|
|
25806
25824
|
|
|
25807
25825
|
/***/ }),
|
|
25808
25826
|
|
|
25809
|
-
/***/ "../../common/temp/node_modules/.pnpm/@babel+runtime@7.
|
|
25827
|
+
/***/ "../../common/temp/node_modules/.pnpm/@babel+runtime@7.19.4/node_modules/@babel/runtime/helpers/iterableToArray.js":
|
|
25810
25828
|
/*!*************************************************************************************************************************!*\
|
|
25811
|
-
!*** ../../common/temp/node_modules/.pnpm/@babel+runtime@7.
|
|
25829
|
+
!*** ../../common/temp/node_modules/.pnpm/@babel+runtime@7.19.4/node_modules/@babel/runtime/helpers/iterableToArray.js ***!
|
|
25812
25830
|
\*************************************************************************************************************************/
|
|
25813
25831
|
/***/ ((module) => {
|
|
25814
25832
|
|
|
@@ -25819,9 +25837,9 @@ module.exports = _iterableToArray, module.exports.__esModule = true, module.expo
|
|
|
25819
25837
|
|
|
25820
25838
|
/***/ }),
|
|
25821
25839
|
|
|
25822
|
-
/***/ "../../common/temp/node_modules/.pnpm/@babel+runtime@7.
|
|
25840
|
+
/***/ "../../common/temp/node_modules/.pnpm/@babel+runtime@7.19.4/node_modules/@babel/runtime/helpers/nonIterableRest.js":
|
|
25823
25841
|
/*!*************************************************************************************************************************!*\
|
|
25824
|
-
!*** ../../common/temp/node_modules/.pnpm/@babel+runtime@7.
|
|
25842
|
+
!*** ../../common/temp/node_modules/.pnpm/@babel+runtime@7.19.4/node_modules/@babel/runtime/helpers/nonIterableRest.js ***!
|
|
25825
25843
|
\*************************************************************************************************************************/
|
|
25826
25844
|
/***/ ((module) => {
|
|
25827
25845
|
|
|
@@ -25832,14 +25850,14 @@ module.exports = _nonIterableRest, module.exports.__esModule = true, module.expo
|
|
|
25832
25850
|
|
|
25833
25851
|
/***/ }),
|
|
25834
25852
|
|
|
25835
|
-
/***/ "../../common/temp/node_modules/.pnpm/@babel+runtime@7.
|
|
25853
|
+
/***/ "../../common/temp/node_modules/.pnpm/@babel+runtime@7.19.4/node_modules/@babel/runtime/helpers/possibleConstructorReturn.js":
|
|
25836
25854
|
/*!***********************************************************************************************************************************!*\
|
|
25837
|
-
!*** ../../common/temp/node_modules/.pnpm/@babel+runtime@7.
|
|
25855
|
+
!*** ../../common/temp/node_modules/.pnpm/@babel+runtime@7.19.4/node_modules/@babel/runtime/helpers/possibleConstructorReturn.js ***!
|
|
25838
25856
|
\***********************************************************************************************************************************/
|
|
25839
25857
|
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
|
25840
25858
|
|
|
25841
|
-
var _typeof = (__webpack_require__(/*! ./typeof.js */ "../../common/temp/node_modules/.pnpm/@babel+runtime@7.
|
|
25842
|
-
var assertThisInitialized = __webpack_require__(/*! ./assertThisInitialized.js */ "../../common/temp/node_modules/.pnpm/@babel+runtime@7.
|
|
25859
|
+
var _typeof = (__webpack_require__(/*! ./typeof.js */ "../../common/temp/node_modules/.pnpm/@babel+runtime@7.19.4/node_modules/@babel/runtime/helpers/typeof.js")["default"]);
|
|
25860
|
+
var assertThisInitialized = __webpack_require__(/*! ./assertThisInitialized.js */ "../../common/temp/node_modules/.pnpm/@babel+runtime@7.19.4/node_modules/@babel/runtime/helpers/assertThisInitialized.js");
|
|
25843
25861
|
function _possibleConstructorReturn(self, call) {
|
|
25844
25862
|
if (call && (_typeof(call) === "object" || typeof call === "function")) {
|
|
25845
25863
|
return call;
|
|
@@ -25852,9 +25870,9 @@ module.exports = _possibleConstructorReturn, module.exports.__esModule = true, m
|
|
|
25852
25870
|
|
|
25853
25871
|
/***/ }),
|
|
25854
25872
|
|
|
25855
|
-
/***/ "../../common/temp/node_modules/.pnpm/@babel+runtime@7.
|
|
25873
|
+
/***/ "../../common/temp/node_modules/.pnpm/@babel+runtime@7.19.4/node_modules/@babel/runtime/helpers/setPrototypeOf.js":
|
|
25856
25874
|
/*!************************************************************************************************************************!*\
|
|
25857
|
-
!*** ../../common/temp/node_modules/.pnpm/@babel+runtime@7.
|
|
25875
|
+
!*** ../../common/temp/node_modules/.pnpm/@babel+runtime@7.19.4/node_modules/@babel/runtime/helpers/setPrototypeOf.js ***!
|
|
25858
25876
|
\************************************************************************************************************************/
|
|
25859
25877
|
/***/ ((module) => {
|
|
25860
25878
|
|
|
@@ -25869,16 +25887,16 @@ module.exports = _setPrototypeOf, module.exports.__esModule = true, module.expor
|
|
|
25869
25887
|
|
|
25870
25888
|
/***/ }),
|
|
25871
25889
|
|
|
25872
|
-
/***/ "../../common/temp/node_modules/.pnpm/@babel+runtime@7.
|
|
25890
|
+
/***/ "../../common/temp/node_modules/.pnpm/@babel+runtime@7.19.4/node_modules/@babel/runtime/helpers/toArray.js":
|
|
25873
25891
|
/*!*****************************************************************************************************************!*\
|
|
25874
|
-
!*** ../../common/temp/node_modules/.pnpm/@babel+runtime@7.
|
|
25892
|
+
!*** ../../common/temp/node_modules/.pnpm/@babel+runtime@7.19.4/node_modules/@babel/runtime/helpers/toArray.js ***!
|
|
25875
25893
|
\*****************************************************************************************************************/
|
|
25876
25894
|
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
|
25877
25895
|
|
|
25878
|
-
var arrayWithHoles = __webpack_require__(/*! ./arrayWithHoles.js */ "../../common/temp/node_modules/.pnpm/@babel+runtime@7.
|
|
25879
|
-
var iterableToArray = __webpack_require__(/*! ./iterableToArray.js */ "../../common/temp/node_modules/.pnpm/@babel+runtime@7.
|
|
25880
|
-
var unsupportedIterableToArray = __webpack_require__(/*! ./unsupportedIterableToArray.js */ "../../common/temp/node_modules/.pnpm/@babel+runtime@7.
|
|
25881
|
-
var nonIterableRest = __webpack_require__(/*! ./nonIterableRest.js */ "../../common/temp/node_modules/.pnpm/@babel+runtime@7.
|
|
25896
|
+
var arrayWithHoles = __webpack_require__(/*! ./arrayWithHoles.js */ "../../common/temp/node_modules/.pnpm/@babel+runtime@7.19.4/node_modules/@babel/runtime/helpers/arrayWithHoles.js");
|
|
25897
|
+
var iterableToArray = __webpack_require__(/*! ./iterableToArray.js */ "../../common/temp/node_modules/.pnpm/@babel+runtime@7.19.4/node_modules/@babel/runtime/helpers/iterableToArray.js");
|
|
25898
|
+
var unsupportedIterableToArray = __webpack_require__(/*! ./unsupportedIterableToArray.js */ "../../common/temp/node_modules/.pnpm/@babel+runtime@7.19.4/node_modules/@babel/runtime/helpers/unsupportedIterableToArray.js");
|
|
25899
|
+
var nonIterableRest = __webpack_require__(/*! ./nonIterableRest.js */ "../../common/temp/node_modules/.pnpm/@babel+runtime@7.19.4/node_modules/@babel/runtime/helpers/nonIterableRest.js");
|
|
25882
25900
|
function _toArray(arr) {
|
|
25883
25901
|
return arrayWithHoles(arr) || iterableToArray(arr) || unsupportedIterableToArray(arr) || nonIterableRest();
|
|
25884
25902
|
}
|
|
@@ -25886,9 +25904,9 @@ module.exports = _toArray, module.exports.__esModule = true, module.exports["def
|
|
|
25886
25904
|
|
|
25887
25905
|
/***/ }),
|
|
25888
25906
|
|
|
25889
|
-
/***/ "../../common/temp/node_modules/.pnpm/@babel+runtime@7.
|
|
25907
|
+
/***/ "../../common/temp/node_modules/.pnpm/@babel+runtime@7.19.4/node_modules/@babel/runtime/helpers/typeof.js":
|
|
25890
25908
|
/*!****************************************************************************************************************!*\
|
|
25891
|
-
!*** ../../common/temp/node_modules/.pnpm/@babel+runtime@7.
|
|
25909
|
+
!*** ../../common/temp/node_modules/.pnpm/@babel+runtime@7.19.4/node_modules/@babel/runtime/helpers/typeof.js ***!
|
|
25892
25910
|
\****************************************************************************************************************/
|
|
25893
25911
|
/***/ ((module) => {
|
|
25894
25912
|
|
|
@@ -25905,13 +25923,13 @@ module.exports = _typeof, module.exports.__esModule = true, module.exports["defa
|
|
|
25905
25923
|
|
|
25906
25924
|
/***/ }),
|
|
25907
25925
|
|
|
25908
|
-
/***/ "../../common/temp/node_modules/.pnpm/@babel+runtime@7.
|
|
25926
|
+
/***/ "../../common/temp/node_modules/.pnpm/@babel+runtime@7.19.4/node_modules/@babel/runtime/helpers/unsupportedIterableToArray.js":
|
|
25909
25927
|
/*!************************************************************************************************************************************!*\
|
|
25910
|
-
!*** ../../common/temp/node_modules/.pnpm/@babel+runtime@7.
|
|
25928
|
+
!*** ../../common/temp/node_modules/.pnpm/@babel+runtime@7.19.4/node_modules/@babel/runtime/helpers/unsupportedIterableToArray.js ***!
|
|
25911
25929
|
\************************************************************************************************************************************/
|
|
25912
25930
|
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
|
25913
25931
|
|
|
25914
|
-
var arrayLikeToArray = __webpack_require__(/*! ./arrayLikeToArray.js */ "../../common/temp/node_modules/.pnpm/@babel+runtime@7.
|
|
25932
|
+
var arrayLikeToArray = __webpack_require__(/*! ./arrayLikeToArray.js */ "../../common/temp/node_modules/.pnpm/@babel+runtime@7.19.4/node_modules/@babel/runtime/helpers/arrayLikeToArray.js");
|
|
25915
25933
|
function _unsupportedIterableToArray(o, minLen) {
|
|
25916
25934
|
if (!o) return;
|
|
25917
25935
|
if (typeof o === "string") return arrayLikeToArray(o, minLen);
|
|
@@ -26442,9 +26460,80 @@ const chai_1 = __webpack_require__(/*! chai */ "../../common/temp/node_modules/.
|
|
|
26442
26460
|
const ITwinLocalization_1 = __webpack_require__(/*! ../ITwinLocalization */ "./lib/cjs/ITwinLocalization.js");
|
|
26443
26461
|
describe("ITwinLocalization", () => {
|
|
26444
26462
|
let localization;
|
|
26463
|
+
let germanLocalization;
|
|
26464
|
+
describe("#constructor", () => {
|
|
26465
|
+
let itwinLocalization;
|
|
26466
|
+
it("set default namespace", async () => {
|
|
26467
|
+
itwinLocalization = new ITwinLocalization_1.ITwinLocalization({ initOptions: { defaultNS: "Default" } });
|
|
26468
|
+
await itwinLocalization.initialize([]);
|
|
26469
|
+
chai_1.assert.equal(itwinLocalization.i18next.options.defaultNS, "Default");
|
|
26470
|
+
chai_1.assert.equal(itwinLocalization.getLocalizedString("FirstTrivial"), "First level string (default)");
|
|
26471
|
+
});
|
|
26472
|
+
it("set default language as english", async () => {
|
|
26473
|
+
itwinLocalization = new ITwinLocalization_1.ITwinLocalization({ initOptions: { defaultNS: "Default", lng: "en" } });
|
|
26474
|
+
await itwinLocalization.initialize([]);
|
|
26475
|
+
chai_1.assert.equal(itwinLocalization.i18next.options.lng, "en");
|
|
26476
|
+
chai_1.assert.equal(itwinLocalization.getLocalizedString("FirstTrivial"), "First level string (default)");
|
|
26477
|
+
});
|
|
26478
|
+
it("set default language as NOT english", async () => {
|
|
26479
|
+
itwinLocalization = new ITwinLocalization_1.ITwinLocalization({ initOptions: { defaultNS: "Default", lng: "de" } });
|
|
26480
|
+
await itwinLocalization.initialize([]);
|
|
26481
|
+
chai_1.assert.equal(itwinLocalization.i18next.options.lng, "de");
|
|
26482
|
+
chai_1.assert.equal(itwinLocalization.getLocalizedString("FirstTrivial"), "First level string (default german)");
|
|
26483
|
+
});
|
|
26484
|
+
it("set fallback language as NOT english", async () => {
|
|
26485
|
+
itwinLocalization = new ITwinLocalization_1.ITwinLocalization({ initOptions: { defaultNS: "Default", fallbackLng: "de" } });
|
|
26486
|
+
await itwinLocalization.initialize([]);
|
|
26487
|
+
chai_1.assert.equal(itwinLocalization.i18next.options.fallbackLng, "de");
|
|
26488
|
+
chai_1.assert.equal(itwinLocalization.getLocalizedString("OnlyGerman"), "Hallo");
|
|
26489
|
+
});
|
|
26490
|
+
});
|
|
26445
26491
|
describe("#initialize", () => {
|
|
26446
|
-
|
|
26447
|
-
|
|
26492
|
+
let itwinLocalization;
|
|
26493
|
+
it("cannot fetch from unregistered namespaces", async () => {
|
|
26494
|
+
localization = new ITwinLocalization_1.ITwinLocalization();
|
|
26495
|
+
await localization.initialize([]);
|
|
26496
|
+
chai_1.assert.equal(localization.getEnglishString("Default", "FirstTrivial"), "FirstTrivial");
|
|
26497
|
+
chai_1.assert.equal(localization.getLocalizedString("Test:FirstTrivial"), "FirstTrivial");
|
|
26498
|
+
});
|
|
26499
|
+
describe("with no default namespace predefined", () => {
|
|
26500
|
+
before(() => {
|
|
26501
|
+
itwinLocalization = new ITwinLocalization_1.ITwinLocalization();
|
|
26502
|
+
});
|
|
26503
|
+
it("no default namespace set when initialized with empty array", async () => {
|
|
26504
|
+
await itwinLocalization.initialize([]);
|
|
26505
|
+
chai_1.assert.equal(itwinLocalization.i18next.options.defaultNS, undefined);
|
|
26506
|
+
});
|
|
26507
|
+
it("initialize with single namespace", async () => {
|
|
26508
|
+
var _a;
|
|
26509
|
+
await itwinLocalization.initialize(["Test"]);
|
|
26510
|
+
chai_1.assert.equal(itwinLocalization.i18next.options.defaultNS, "Test");
|
|
26511
|
+
chai_1.assert.isTrue((_a = itwinLocalization.i18next.options.ns) === null || _a === void 0 ? void 0 : _a.includes("Test"));
|
|
26512
|
+
chai_1.assert.equal(itwinLocalization.getLocalizedString("Test:FirstTrivial"), "First level string (test)");
|
|
26513
|
+
});
|
|
26514
|
+
it("initialize with two namespaces recognizes both namespaces", async () => {
|
|
26515
|
+
var _a, _b;
|
|
26516
|
+
await itwinLocalization.initialize(["Default", "Test"]);
|
|
26517
|
+
chai_1.assert.isTrue((_a = itwinLocalization.i18next.options.ns) === null || _a === void 0 ? void 0 : _a.includes("Default"));
|
|
26518
|
+
chai_1.assert.isTrue((_b = itwinLocalization.i18next.options.ns) === null || _b === void 0 ? void 0 : _b.includes("Test"));
|
|
26519
|
+
chai_1.assert.equal(itwinLocalization.getLocalizedString("Default:FirstTrivial"), "First level string (default)");
|
|
26520
|
+
chai_1.assert.equal(itwinLocalization.getLocalizedString("Test:FirstTrivial"), "First level string (test)");
|
|
26521
|
+
});
|
|
26522
|
+
it("initialize with two namespaces sets first as default", async () => {
|
|
26523
|
+
await itwinLocalization.initialize(["Default", "Test"]);
|
|
26524
|
+
chai_1.assert.equal(itwinLocalization.i18next.options.defaultNS, "Default");
|
|
26525
|
+
chai_1.assert.equal(itwinLocalization.getLocalizedString("FirstTrivial"), "First level string (default)");
|
|
26526
|
+
});
|
|
26527
|
+
it("initialize with duplicate namespace values does not break anything", async () => {
|
|
26528
|
+
var _a;
|
|
26529
|
+
await itwinLocalization.initialize(["Default", "Default"]);
|
|
26530
|
+
chai_1.assert.equal(itwinLocalization.i18next.options.defaultNS, "Default");
|
|
26531
|
+
chai_1.assert.isTrue((_a = itwinLocalization.i18next.options.ns) === null || _a === void 0 ? void 0 : _a.includes("Default"));
|
|
26532
|
+
chai_1.assert.equal(itwinLocalization.getLocalizedString("FirstTrivial"), "First level string (default)");
|
|
26533
|
+
chai_1.assert.equal(itwinLocalization.getLocalizedString("Default:FirstTrivial"), "First level string (default)");
|
|
26534
|
+
});
|
|
26535
|
+
});
|
|
26536
|
+
describe("with default namespace", () => {
|
|
26448
26537
|
before(() => {
|
|
26449
26538
|
itwinLocalization = new ITwinLocalization_1.ITwinLocalization({ initOptions: { defaultNS: "Default" } });
|
|
26450
26539
|
});
|
|
@@ -26476,6 +26565,93 @@ describe("ITwinLocalization", () => {
|
|
|
26476
26565
|
});
|
|
26477
26566
|
});
|
|
26478
26567
|
});
|
|
26568
|
+
describe("#getLocalizedKeys", () => {
|
|
26569
|
+
before(async () => {
|
|
26570
|
+
localization = new ITwinLocalization_1.ITwinLocalization();
|
|
26571
|
+
await localization.initialize(["Default", "Test"]);
|
|
26572
|
+
germanLocalization = new ITwinLocalization_1.ITwinLocalization({ initOptions: { lng: "de" } });
|
|
26573
|
+
await germanLocalization.initialize(["Default", "Test"]);
|
|
26574
|
+
});
|
|
26575
|
+
it("no substitution", () => {
|
|
26576
|
+
chai_1.assert.equal(localization.getLocalizedKeys("MyString"), "MyString");
|
|
26577
|
+
});
|
|
26578
|
+
describe("Default Namespace", () => {
|
|
26579
|
+
it("first level string", () => {
|
|
26580
|
+
chai_1.assert.equal(localization.getLocalizedKeys("hi %{FirstTrivial}"), "hi First level string (default)");
|
|
26581
|
+
chai_1.assert.equal(germanLocalization.getLocalizedKeys("hi %{FirstTrivial}"), "hi First level string (default german)");
|
|
26582
|
+
});
|
|
26583
|
+
it("second level string", () => {
|
|
26584
|
+
chai_1.assert.equal(localization.getLocalizedKeys("%{SecondTrivial.Test1}"), "Second level string 1 (default)");
|
|
26585
|
+
chai_1.assert.equal(localization.getLocalizedKeys("bye %{SecondTrivial.Test2}"), "bye Second level string 2 (default)");
|
|
26586
|
+
chai_1.assert.equal(germanLocalization.getLocalizedKeys("%{SecondTrivial.Test1}"), "Second level string 1 (default german)");
|
|
26587
|
+
chai_1.assert.equal(germanLocalization.getLocalizedKeys("bye %{SecondTrivial.Test2}"), "bye Second level string 2 (default german)");
|
|
26588
|
+
});
|
|
26589
|
+
it("first level string with keys", () => {
|
|
26590
|
+
chai_1.assert.equal(localization.getLocalizedKeys("%{FirstSubstitution1}"), "First level {{str}} (default)");
|
|
26591
|
+
chai_1.assert.equal(localization.getLocalizedKeys("bye %{FirstSubstitution2}"), "bye First level {{str1}} and {{str2}} (default)");
|
|
26592
|
+
chai_1.assert.equal(germanLocalization.getLocalizedKeys("%{FirstSubstitution1}"), "First level {{str}} (default german)");
|
|
26593
|
+
chai_1.assert.equal(germanLocalization.getLocalizedKeys("bye %{FirstSubstitution2}"), "bye First level {{str1}} and {{str2}} (default german)");
|
|
26594
|
+
});
|
|
26595
|
+
it("second level string with keys", () => {
|
|
26596
|
+
chai_1.assert.equal(localization.getLocalizedKeys("%{SecondSubstitution.Test1}"), "Substitute {{varA}} and {{varB}} (default)");
|
|
26597
|
+
chai_1.assert.equal(localization.getLocalizedKeys("hi %{SecondSubstitution.Test2}"), "hi Reverse substitute {{varB}} and {{varA}} (default)");
|
|
26598
|
+
chai_1.assert.equal(germanLocalization.getLocalizedKeys("%{SecondSubstitution.Test1}"), "Substitute {{varA}} and {{varB}} (default german)");
|
|
26599
|
+
chai_1.assert.equal(germanLocalization.getLocalizedKeys("hi %{SecondSubstitution.Test2}"), "hi Reverse substitute {{varB}} and {{varA}} (default german)");
|
|
26600
|
+
});
|
|
26601
|
+
it("first level missing key doesn't find a value", () => {
|
|
26602
|
+
chai_1.assert.equal(localization.getLocalizedKeys("no %{MissingKeyString}"), "no MissingKeyString");
|
|
26603
|
+
chai_1.assert.equal(localization.getLocalizedKeys("no %{MissingKeyString}"), "no MissingKeyString");
|
|
26604
|
+
});
|
|
26605
|
+
it("second level missing key doesn't find a value", () => {
|
|
26606
|
+
chai_1.assert.equal(localization.getLocalizedKeys("hi %{SecondTrivial.MissingString}"), "hi SecondTrivial.MissingString");
|
|
26607
|
+
chai_1.assert.equal(localization.getLocalizedKeys("%{MissingKeyObject.MissingString}"), "MissingKeyObject.MissingString");
|
|
26608
|
+
});
|
|
26609
|
+
});
|
|
26610
|
+
describe("Given Namespace", () => {
|
|
26611
|
+
it("first level string", () => {
|
|
26612
|
+
chai_1.assert.equal(localization.getLocalizedKeys("hi %{Default:FirstTrivial}"), "hi First level string (default)");
|
|
26613
|
+
chai_1.assert.equal(localization.getLocalizedKeys("hi %{Test:FirstTrivial}"), "hi First level string (test)");
|
|
26614
|
+
});
|
|
26615
|
+
it("second level string", () => {
|
|
26616
|
+
chai_1.assert.equal(localization.getLocalizedKeys("%{Default:SecondTrivial.Test1}"), "Second level string 1 (default)");
|
|
26617
|
+
chai_1.assert.equal(localization.getLocalizedKeys("bye %{Default:SecondTrivial.Test2}"), "bye Second level string 2 (default)");
|
|
26618
|
+
chai_1.assert.equal(localization.getLocalizedKeys("%{Test:SecondTrivial.Test1}"), "Second level string 1 (test)");
|
|
26619
|
+
chai_1.assert.equal(localization.getLocalizedKeys("bye %{Test:SecondTrivial.Test2}"), "bye Second level string 2 (test)");
|
|
26620
|
+
});
|
|
26621
|
+
it("first level string with keys", () => {
|
|
26622
|
+
chai_1.assert.equal(localization.getLocalizedKeys("%{Default:FirstSubstitution1}"), "First level {{str}} (default)");
|
|
26623
|
+
chai_1.assert.equal(localization.getLocalizedKeys("bye %{Default:FirstSubstitution2}"), "bye First level {{str1}} and {{str2}} (default)");
|
|
26624
|
+
chai_1.assert.equal(localization.getLocalizedKeys("%{Test:FirstSubstitution1}"), "First level {{str}} (test)");
|
|
26625
|
+
chai_1.assert.equal(localization.getLocalizedKeys("bye %{Test:FirstSubstitution2}"), "bye First level {{str1}} and {{str2}} (test)");
|
|
26626
|
+
});
|
|
26627
|
+
it("second level string with keys", () => {
|
|
26628
|
+
chai_1.assert.equal(localization.getLocalizedKeys("%{Default:SecondSubstitution.Test1}"), "Substitute {{varA}} and {{varB}} (default)");
|
|
26629
|
+
chai_1.assert.equal(localization.getLocalizedKeys("hi %{Default:SecondSubstitution.Test2}"), "hi Reverse substitute {{varB}} and {{varA}} (default)");
|
|
26630
|
+
chai_1.assert.equal(localization.getLocalizedKeys("%{Test:SecondSubstitution.Test1}"), "Substitute {{varA}} and {{varB}} (test)");
|
|
26631
|
+
chai_1.assert.equal(localization.getLocalizedKeys("hi %{Test:SecondSubstitution.Test2}"), "hi Reverse substitute {{varB}} and {{varA}} (test)");
|
|
26632
|
+
});
|
|
26633
|
+
it("first level missing key doesn't find a value", () => {
|
|
26634
|
+
chai_1.assert.equal(localization.getLocalizedKeys("no %{Default:MissingKeyString}"), "no MissingKeyString");
|
|
26635
|
+
chai_1.assert.equal(localization.getLocalizedKeys("no %{Test:MissingKeyString}"), "no MissingKeyString");
|
|
26636
|
+
});
|
|
26637
|
+
it("second level missing key doesn't find a value", () => {
|
|
26638
|
+
chai_1.assert.equal(localization.getLocalizedKeys("hi %{Default:SecondTrivial.MissingString}"), "hi SecondTrivial.MissingString");
|
|
26639
|
+
chai_1.assert.equal(localization.getLocalizedKeys("%{Default:MissingKeyObject.MissingString}"), "MissingKeyObject.MissingString");
|
|
26640
|
+
chai_1.assert.equal(localization.getLocalizedKeys("hi %{Test:SecondTrivial.MissingString}"), "hi SecondTrivial.MissingString");
|
|
26641
|
+
chai_1.assert.equal(localization.getLocalizedKeys("%{Test:MissingKeyObject.MissingString}"), "MissingKeyObject.MissingString");
|
|
26642
|
+
});
|
|
26643
|
+
});
|
|
26644
|
+
describe("Nonexisting Namespace", () => {
|
|
26645
|
+
it("first level fails", () => {
|
|
26646
|
+
chai_1.assert.equal(localization.getLocalizedKeys("%{Nonexisting:FirstTrivial}"), "FirstTrivial");
|
|
26647
|
+
chai_1.assert.equal(localization.getLocalizedKeys("%{Nonexisting:MissingKeyString}"), "MissingKeyString");
|
|
26648
|
+
});
|
|
26649
|
+
it("second level fails", () => {
|
|
26650
|
+
chai_1.assert.equal(localization.getLocalizedKeys("%{Nonexisting:SecondTrivial.Test1}"), "SecondTrivial.Test1");
|
|
26651
|
+
chai_1.assert.equal(localization.getLocalizedKeys("%{Nonexisting:Missing.String}"), "Missing.String");
|
|
26652
|
+
});
|
|
26653
|
+
});
|
|
26654
|
+
});
|
|
26479
26655
|
// The goal is not to test i18next's interpolation,
|
|
26480
26656
|
// but just to have some simple tests to make sure the
|
|
26481
26657
|
// basics work through the ITwinLocalization class.
|
|
@@ -26484,30 +26660,106 @@ describe("ITwinLocalization", () => {
|
|
|
26484
26660
|
before(async () => {
|
|
26485
26661
|
localization = new ITwinLocalization_1.ITwinLocalization();
|
|
26486
26662
|
await localization.initialize(["Default", "Test"]);
|
|
26663
|
+
germanLocalization = new ITwinLocalization_1.ITwinLocalization({ initOptions: { lng: "de" } });
|
|
26664
|
+
await germanLocalization.initialize(["Default", "Test"]);
|
|
26487
26665
|
});
|
|
26488
26666
|
describe("Default Namespace", () => {
|
|
26489
26667
|
it("first level with no substitution", () => {
|
|
26490
26668
|
chai_1.assert.equal(localization.getLocalizedString("FirstTrivial"), "First level string (default)");
|
|
26491
26669
|
});
|
|
26670
|
+
it("first level with no substitution with fallback keys", () => {
|
|
26671
|
+
chai_1.assert.equal(localization.getLocalizedString(["FirstTrivial", "NotExist"]), "First level string (default)");
|
|
26672
|
+
chai_1.assert.equal(localization.getLocalizedString(["NotExist", "FirstTrivial"]), "First level string (default)");
|
|
26673
|
+
});
|
|
26674
|
+
it("more than two fallback keys succeeds", () => {
|
|
26675
|
+
chai_1.assert.equal(localization.getLocalizedString(["FirstTrivial", "NotExist1", "NotExist2"]), "First level string (default)");
|
|
26676
|
+
chai_1.assert.equal(localization.getLocalizedString(["NotExist1", "FirstTrivial", "NotExist2"]), "First level string (default)");
|
|
26677
|
+
chai_1.assert.equal(localization.getLocalizedString(["NotExist1", "NotExist2", "FirstTrivial"]), "First level string (default)");
|
|
26678
|
+
chai_1.assert.equal(localization.getLocalizedString(["1", "2", "3", "4", "5", "FirstTrivial"]), "First level string (default)");
|
|
26679
|
+
});
|
|
26492
26680
|
it("second level with no substitution", () => {
|
|
26493
26681
|
chai_1.assert.equal(localization.getLocalizedString("SecondTrivial.Test1"), "Second level string 1 (default)");
|
|
26494
26682
|
chai_1.assert.equal(localization.getLocalizedString("SecondTrivial.Test2"), "Second level string 2 (default)");
|
|
26495
26683
|
});
|
|
26684
|
+
it("second level with no substitution with fallback keys", () => {
|
|
26685
|
+
chai_1.assert.equal(localization.getLocalizedString(["NotExist", "SecondTrivial.Test1"]), "Second level string 1 (default)");
|
|
26686
|
+
chai_1.assert.equal(localization.getLocalizedString(["SecondTrivial.Test2", "NotExist"]), "Second level string 2 (default)");
|
|
26687
|
+
});
|
|
26496
26688
|
it("first level with substitution", () => {
|
|
26497
26689
|
chai_1.assert.equal(localization.getLocalizedString("FirstSubstitution1", { str: "CUSTOM1" }), "First level CUSTOM1 (default)");
|
|
26498
26690
|
chai_1.assert.equal(localization.getLocalizedString("FirstSubstitution1", { str: "CUSTOM2" }), "First level CUSTOM2 (default)");
|
|
26499
26691
|
chai_1.assert.equal(localization.getLocalizedString("FirstSubstitution2", { str1: "CUSTOM1", str2: "CUSTOM2" }), "First level CUSTOM1 and CUSTOM2 (default)");
|
|
26500
26692
|
});
|
|
26693
|
+
it("first level with substitution with fallback keys", () => {
|
|
26694
|
+
chai_1.assert.equal(localization.getLocalizedString(["NotExist", "FirstSubstitution1"], { str: "CUSTOM1" }), "First level CUSTOM1 (default)");
|
|
26695
|
+
chai_1.assert.equal(localization.getLocalizedString(["FirstSubstitution1", "NotExist"], { str: "CUSTOM2" }), "First level CUSTOM2 (default)");
|
|
26696
|
+
chai_1.assert.equal(localization.getLocalizedString(["NotExist", "FirstSubstitution2"], { str1: "CUSTOM1", str2: "CUSTOM2" }), "First level CUSTOM1 and CUSTOM2 (default)");
|
|
26697
|
+
});
|
|
26501
26698
|
it("second level with substitution", () => {
|
|
26502
26699
|
chai_1.assert.equal(localization.getLocalizedString("SecondSubstitution.Test1", { varA: "Variable1", varB: "Variable2" }), "Substitute Variable1 and Variable2 (default)");
|
|
26503
26700
|
chai_1.assert.equal(localization.getLocalizedString("SecondSubstitution.Test2", { varA: "Variable1", varB: "Variable2" }), "Reverse substitute Variable2 and Variable1 (default)");
|
|
26504
26701
|
});
|
|
26702
|
+
it("second level with substitution with fallback keys", () => {
|
|
26703
|
+
chai_1.assert.equal(localization.getLocalizedString(["NotExist", "SecondSubstitution.Test1"], { varA: "Variable1", varB: "Variable2" }), "Substitute Variable1 and Variable2 (default)");
|
|
26704
|
+
chai_1.assert.equal(localization.getLocalizedString(["SecondSubstitution.Test2", "NotExist"], { varA: "Variable1", varB: "Variable2" }), "Reverse substitute Variable2 and Variable1 (default)");
|
|
26705
|
+
});
|
|
26505
26706
|
it("first level missing key doesn't find a value", () => {
|
|
26506
26707
|
chai_1.assert.equal(localization.getLocalizedString("MissingKeyString"), "MissingKeyString");
|
|
26507
26708
|
});
|
|
26709
|
+
it("first level missing all keys doesn't find a value", () => {
|
|
26710
|
+
chai_1.assert.equal(localization.getLocalizedString(["MissingKeyString", "MissingString2"]), "MissingString2");
|
|
26711
|
+
});
|
|
26508
26712
|
it("second level missing key doesn't find a value", () => {
|
|
26509
26713
|
chai_1.assert.equal(localization.getLocalizedString("SecondTrivial.MissingString"), "SecondTrivial.MissingString");
|
|
26510
|
-
chai_1.assert.equal(localization.getLocalizedString("MissingKeyObject.MissingString"), "MissingKeyObject.MissingString");
|
|
26714
|
+
chai_1.assert.equal(localization.getLocalizedString(["NotExist", "MissingKeyObject.MissingString"]), "MissingKeyObject.MissingString");
|
|
26715
|
+
});
|
|
26716
|
+
it("read from en-US fallback", () => {
|
|
26717
|
+
chai_1.assert.equal(localization.getLocalizedString("OnlyEnglishUS"), "HelloUS");
|
|
26718
|
+
});
|
|
26719
|
+
});
|
|
26720
|
+
describe("Default Namespace (German)", () => {
|
|
26721
|
+
it("first level with no substitution", () => {
|
|
26722
|
+
chai_1.assert.equal(germanLocalization.getLocalizedString("FirstTrivial"), "First level string (default german)");
|
|
26723
|
+
});
|
|
26724
|
+
it("first level with no substitution with fallback keys", () => {
|
|
26725
|
+
chai_1.assert.equal(germanLocalization.getLocalizedString(["FirstTrivial", "NotExist"]), "First level string (default german)");
|
|
26726
|
+
chai_1.assert.equal(germanLocalization.getLocalizedString(["NotExist", "FirstTrivial"]), "First level string (default german)");
|
|
26727
|
+
});
|
|
26728
|
+
it("second level with no substitution", () => {
|
|
26729
|
+
chai_1.assert.equal(germanLocalization.getLocalizedString("SecondTrivial.Test1"), "Second level string 1 (default german)");
|
|
26730
|
+
chai_1.assert.equal(germanLocalization.getLocalizedString("SecondTrivial.Test2"), "Second level string 2 (default german)");
|
|
26731
|
+
});
|
|
26732
|
+
it("second level with no substitution with fallback keys", () => {
|
|
26733
|
+
chai_1.assert.equal(germanLocalization.getLocalizedString(["NotExist", "SecondTrivial.Test1"]), "Second level string 1 (default german)");
|
|
26734
|
+
chai_1.assert.equal(germanLocalization.getLocalizedString(["SecondTrivial.Test2", "NotExist"]), "Second level string 2 (default german)");
|
|
26735
|
+
});
|
|
26736
|
+
it("first level with substitution", () => {
|
|
26737
|
+
chai_1.assert.equal(germanLocalization.getLocalizedString("FirstSubstitution1", { str: "CUSTOM1" }), "First level CUSTOM1 (default german)");
|
|
26738
|
+
chai_1.assert.equal(germanLocalization.getLocalizedString("FirstSubstitution1", { str: "CUSTOM2" }), "First level CUSTOM2 (default german)");
|
|
26739
|
+
chai_1.assert.equal(germanLocalization.getLocalizedString("FirstSubstitution2", { str1: "CUSTOM1", str2: "CUSTOM2" }), "First level CUSTOM1 and CUSTOM2 (default german)");
|
|
26740
|
+
});
|
|
26741
|
+
it("first level with substitution with fallback keys", () => {
|
|
26742
|
+
chai_1.assert.equal(germanLocalization.getLocalizedString(["NotExist", "FirstSubstitution1"], { str: "CUSTOM1" }), "First level CUSTOM1 (default german)");
|
|
26743
|
+
chai_1.assert.equal(germanLocalization.getLocalizedString(["FirstSubstitution1", "NotExist"], { str: "CUSTOM2" }), "First level CUSTOM2 (default german)");
|
|
26744
|
+
chai_1.assert.equal(germanLocalization.getLocalizedString(["NotExist", "FirstSubstitution2"], { str1: "CUSTOM1", str2: "CUSTOM2" }), "First level CUSTOM1 and CUSTOM2 (default german)");
|
|
26745
|
+
});
|
|
26746
|
+
it("second level with substitution", () => {
|
|
26747
|
+
chai_1.assert.equal(germanLocalization.getLocalizedString("SecondSubstitution.Test1", { varA: "Variable1", varB: "Variable2" }), "Substitute Variable1 and Variable2 (default german)");
|
|
26748
|
+
chai_1.assert.equal(germanLocalization.getLocalizedString("SecondSubstitution.Test2", { varA: "Variable1", varB: "Variable2" }), "Reverse substitute Variable2 and Variable1 (default german)");
|
|
26749
|
+
});
|
|
26750
|
+
it("second level with substitution with fallback keys", () => {
|
|
26751
|
+
chai_1.assert.equal(germanLocalization.getLocalizedString(["NotExist", "SecondSubstitution.Test1"], { varA: "Variable1", varB: "Variable2" }), "Substitute Variable1 and Variable2 (default german)");
|
|
26752
|
+
chai_1.assert.equal(germanLocalization.getLocalizedString(["SecondSubstitution.Test2", "NotExist"], { varA: "Variable1", varB: "Variable2" }), "Reverse substitute Variable2 and Variable1 (default german)");
|
|
26753
|
+
});
|
|
26754
|
+
it("first level missing key doesn't find a value", () => {
|
|
26755
|
+
chai_1.assert.equal(germanLocalization.getLocalizedString("MissingKeyString"), "MissingKeyString");
|
|
26756
|
+
});
|
|
26757
|
+
it("first level missing all keys doesn't find a value", () => {
|
|
26758
|
+
chai_1.assert.equal(germanLocalization.getLocalizedString(["MissingKeyString", "MissingString2"]), "MissingString2");
|
|
26759
|
+
});
|
|
26760
|
+
it("second level missing key doesn't find a value", () => {
|
|
26761
|
+
chai_1.assert.equal(germanLocalization.getLocalizedString("SecondTrivial.MissingString"), "SecondTrivial.MissingString");
|
|
26762
|
+
chai_1.assert.equal(germanLocalization.getLocalizedString("MissingKeyObject.MissingString"), "MissingKeyObject.MissingString");
|
|
26511
26763
|
});
|
|
26512
26764
|
});
|
|
26513
26765
|
describe("Given Namespace", () => {
|
|
@@ -26515,12 +26767,20 @@ describe("ITwinLocalization", () => {
|
|
|
26515
26767
|
chai_1.assert.equal(localization.getLocalizedString("Default:FirstTrivial"), "First level string (default)");
|
|
26516
26768
|
chai_1.assert.equal(localization.getLocalizedString("Test:FirstTrivial"), "First level string (test)");
|
|
26517
26769
|
});
|
|
26770
|
+
it("first level with no substitution with fallback keys", () => {
|
|
26771
|
+
chai_1.assert.equal(localization.getLocalizedString(["Default:FirstTrivial", "Not:NotExist"]), "First level string (default)");
|
|
26772
|
+
chai_1.assert.equal(localization.getLocalizedString(["Default:NotExist", "Test:FirstTrivial"]), "First level string (test)");
|
|
26773
|
+
});
|
|
26518
26774
|
it("second level with no substitution", () => {
|
|
26519
26775
|
chai_1.assert.equal(localization.getLocalizedString("Default:SecondTrivial.Test1"), "Second level string 1 (default)");
|
|
26520
26776
|
chai_1.assert.equal(localization.getLocalizedString("Default:SecondTrivial.Test2"), "Second level string 2 (default)");
|
|
26521
26777
|
chai_1.assert.equal(localization.getLocalizedString("Test:SecondTrivial.Test1"), "Second level string 1 (test)");
|
|
26522
26778
|
chai_1.assert.equal(localization.getLocalizedString("Test:SecondTrivial.Test2"), "Second level string 2 (test)");
|
|
26523
26779
|
});
|
|
26780
|
+
it("second level with no substitution with fallback keys", () => {
|
|
26781
|
+
chai_1.assert.equal(localization.getLocalizedString(["Test:NotExist", "Default:SecondTrivial.Test1"]), "Second level string 1 (default)");
|
|
26782
|
+
chai_1.assert.equal(localization.getLocalizedString(["Test:SecondTrivial.Test2", "NotExist"]), "Second level string 2 (test)");
|
|
26783
|
+
});
|
|
26524
26784
|
it("first level with substitution", () => {
|
|
26525
26785
|
chai_1.assert.equal(localization.getLocalizedString("Default:FirstSubstitution1", { str: "CUSTOM1" }), "First level CUSTOM1 (default)");
|
|
26526
26786
|
chai_1.assert.equal(localization.getLocalizedString("Default:FirstSubstitution1", { str: "CUSTOM2" }), "First level CUSTOM2 (default)");
|
|
@@ -26529,12 +26789,21 @@ describe("ITwinLocalization", () => {
|
|
|
26529
26789
|
chai_1.assert.equal(localization.getLocalizedString("Test:FirstSubstitution1", { str: "CUSTOM2" }), "First level CUSTOM2 (test)");
|
|
26530
26790
|
chai_1.assert.equal(localization.getLocalizedString("Test:FirstSubstitution2", { str1: "CUSTOM1", str2: "CUSTOM2" }), "First level CUSTOM1 and CUSTOM2 (test)");
|
|
26531
26791
|
});
|
|
26792
|
+
it("first level with substitution with fallback keys", () => {
|
|
26793
|
+
chai_1.assert.equal(localization.getLocalizedString(["Test:NotExist", "Default:FirstSubstitution1"], { str: "CUSTOM1" }), "First level CUSTOM1 (default)");
|
|
26794
|
+
chai_1.assert.equal(localization.getLocalizedString(["Test:FirstSubstitution1", "Default:NotExist"], { str: "CUSTOM2" }), "First level CUSTOM2 (test)");
|
|
26795
|
+
chai_1.assert.equal(localization.getLocalizedString(["Test:NotExist", "Default:FirstSubstitution2"], { str1: "CUSTOM1", str2: "CUSTOM2" }), "First level CUSTOM1 and CUSTOM2 (default)");
|
|
26796
|
+
});
|
|
26532
26797
|
it("second level with substitution", () => {
|
|
26533
26798
|
chai_1.assert.equal(localization.getLocalizedString("Default:SecondSubstitution.Test1", { varA: "Variable1", varB: "Variable2" }), "Substitute Variable1 and Variable2 (default)");
|
|
26534
26799
|
chai_1.assert.equal(localization.getLocalizedString("Default:SecondSubstitution.Test2", { varA: "Variable1", varB: "Variable2" }), "Reverse substitute Variable2 and Variable1 (default)");
|
|
26535
26800
|
chai_1.assert.equal(localization.getLocalizedString("Test:SecondSubstitution.Test1", { varA: "Variable1", varB: "Variable2" }), "Substitute Variable1 and Variable2 (test)");
|
|
26536
26801
|
chai_1.assert.equal(localization.getLocalizedString("Test:SecondSubstitution.Test2", { varA: "Variable1", varB: "Variable2" }), "Reverse substitute Variable2 and Variable1 (test)");
|
|
26537
26802
|
});
|
|
26803
|
+
it("second level with substitution with fallback keys", () => {
|
|
26804
|
+
chai_1.assert.equal(localization.getLocalizedString(["Test:NotExist", "Default:SecondSubstitution.Test1"], { varA: "Variable1", varB: "Variable2" }), "Substitute Variable1 and Variable2 (default)");
|
|
26805
|
+
chai_1.assert.equal(localization.getLocalizedString(["Test:SecondSubstitution.Test2", "Default:NotExist"], { varA: "Variable1", varB: "Variable2" }), "Reverse substitute Variable2 and Variable1 (test)");
|
|
26806
|
+
});
|
|
26538
26807
|
it("first level missing key doesn't find a value", () => {
|
|
26539
26808
|
chai_1.assert.equal(localization.getLocalizedString("Default:MissingKeyString"), "MissingKeyString");
|
|
26540
26809
|
chai_1.assert.equal(localization.getLocalizedString("Test:MissingKeyString"), "MissingKeyString");
|
|
@@ -26543,6 +26812,43 @@ describe("ITwinLocalization", () => {
|
|
|
26543
26812
|
chai_1.assert.equal(localization.getLocalizedString("Test:SecondTrivial.MissingString"), "SecondTrivial.MissingString");
|
|
26544
26813
|
chai_1.assert.equal(localization.getLocalizedString("Test:MissingKeyObject.MissingString"), "MissingKeyObject.MissingString");
|
|
26545
26814
|
});
|
|
26815
|
+
it("read from en-US fallback", () => {
|
|
26816
|
+
chai_1.assert.equal(localization.getLocalizedString("Default:OnlyEnglishUS"), "HelloUS");
|
|
26817
|
+
});
|
|
26818
|
+
});
|
|
26819
|
+
describe("Given Namespace (German)", () => {
|
|
26820
|
+
it("first level with no substitution", () => {
|
|
26821
|
+
chai_1.assert.equal(germanLocalization.getLocalizedString("Default:FirstTrivial"), "First level string (default german)");
|
|
26822
|
+
chai_1.assert.equal(germanLocalization.getLocalizedString("Test:FirstTrivial"), "First level string (german)");
|
|
26823
|
+
});
|
|
26824
|
+
it("second level with no substitution", () => {
|
|
26825
|
+
chai_1.assert.equal(germanLocalization.getLocalizedString("Default:SecondTrivial.Test1"), "Second level string 1 (default german)");
|
|
26826
|
+
chai_1.assert.equal(germanLocalization.getLocalizedString("Default:SecondTrivial.Test2"), "Second level string 2 (default german)");
|
|
26827
|
+
chai_1.assert.equal(germanLocalization.getLocalizedString("Test:SecondTrivial.Test1"), "Second level string 1 (german)");
|
|
26828
|
+
chai_1.assert.equal(germanLocalization.getLocalizedString("Test:SecondTrivial.Test2"), "Second level string 2 (german)");
|
|
26829
|
+
});
|
|
26830
|
+
it("first level with substitution", () => {
|
|
26831
|
+
chai_1.assert.equal(germanLocalization.getLocalizedString("Default:FirstSubstitution1", { str: "CUSTOM1" }), "First level CUSTOM1 (default german)");
|
|
26832
|
+
chai_1.assert.equal(germanLocalization.getLocalizedString("Default:FirstSubstitution1", { str: "CUSTOM2" }), "First level CUSTOM2 (default german)");
|
|
26833
|
+
chai_1.assert.equal(germanLocalization.getLocalizedString("Default:FirstSubstitution2", { str1: "CUSTOM1", str2: "CUSTOM2" }), "First level CUSTOM1 and CUSTOM2 (default german)");
|
|
26834
|
+
chai_1.assert.equal(germanLocalization.getLocalizedString("Test:FirstSubstitution1", { str: "CUSTOM1" }), "First level CUSTOM1 (german)");
|
|
26835
|
+
chai_1.assert.equal(germanLocalization.getLocalizedString("Test:FirstSubstitution1", { str: "CUSTOM2" }), "First level CUSTOM2 (german)");
|
|
26836
|
+
chai_1.assert.equal(germanLocalization.getLocalizedString("Test:FirstSubstitution2", { str1: "CUSTOM1", str2: "CUSTOM2" }), "First level CUSTOM1 and CUSTOM2 (german)");
|
|
26837
|
+
});
|
|
26838
|
+
it("second level with substitution", () => {
|
|
26839
|
+
chai_1.assert.equal(germanLocalization.getLocalizedString("Default:SecondSubstitution.Test1", { varA: "Variable1", varB: "Variable2" }), "Substitute Variable1 and Variable2 (default german)");
|
|
26840
|
+
chai_1.assert.equal(germanLocalization.getLocalizedString("Default:SecondSubstitution.Test2", { varA: "Variable1", varB: "Variable2" }), "Reverse substitute Variable2 and Variable1 (default german)");
|
|
26841
|
+
chai_1.assert.equal(germanLocalization.getLocalizedString("Test:SecondSubstitution.Test1", { varA: "Variable1", varB: "Variable2" }), "Substitute Variable1 and Variable2 (german)");
|
|
26842
|
+
chai_1.assert.equal(germanLocalization.getLocalizedString("Test:SecondSubstitution.Test2", { varA: "Variable1", varB: "Variable2" }), "Reverse substitute Variable2 and Variable1 (german)");
|
|
26843
|
+
});
|
|
26844
|
+
it("first level missing key doesn't find a value", () => {
|
|
26845
|
+
chai_1.assert.equal(germanLocalization.getLocalizedString("Default:MissingKeyString"), "MissingKeyString");
|
|
26846
|
+
chai_1.assert.equal(germanLocalization.getLocalizedString("Test:MissingKeyString"), "MissingKeyString");
|
|
26847
|
+
});
|
|
26848
|
+
it("second level missing key doesn't find a value", () => {
|
|
26849
|
+
chai_1.assert.equal(germanLocalization.getLocalizedString("Test:SecondTrivial.MissingString"), "SecondTrivial.MissingString");
|
|
26850
|
+
chai_1.assert.equal(germanLocalization.getLocalizedString("Test:MissingKeyObject.MissingString"), "MissingKeyObject.MissingString");
|
|
26851
|
+
});
|
|
26546
26852
|
});
|
|
26547
26853
|
describe("Nonexisting Namespace", () => {
|
|
26548
26854
|
it("first level fails", () => {
|
|
@@ -26553,8 +26859,473 @@ describe("ITwinLocalization", () => {
|
|
|
26553
26859
|
chai_1.assert.equal(localization.getLocalizedString("Nonexisting:SecondTrivial.Test1"), "SecondTrivial.Test1");
|
|
26554
26860
|
chai_1.assert.equal(localization.getLocalizedString("Nonexisting:Missing.String"), "Missing.String");
|
|
26555
26861
|
});
|
|
26862
|
+
it("fallback key fails", () => {
|
|
26863
|
+
chai_1.assert.equal(localization.getLocalizedString(["Nonexisting:FirstTrivial", "NotExist"]), "NotExist");
|
|
26864
|
+
chai_1.assert.equal(localization.getLocalizedString(["NotExist", "Nonexisting:Missing.String"]), "Missing.String");
|
|
26865
|
+
});
|
|
26866
|
+
});
|
|
26867
|
+
// Test a few options to make sure they get passed through correctly
|
|
26868
|
+
describe("With Options", () => {
|
|
26869
|
+
it("returnDetails throws error", () => {
|
|
26870
|
+
chai_1.assert.throws(() => {
|
|
26871
|
+
localization.getLocalizedString("X", { returnDetails: true });
|
|
26872
|
+
}, "Translation key must map to a string, but the given options will result in an object");
|
|
26873
|
+
});
|
|
26874
|
+
it("returnObjects throws error", () => {
|
|
26875
|
+
chai_1.assert.throws(() => {
|
|
26876
|
+
localization.getLocalizedString("X", { returnObjects: true });
|
|
26877
|
+
}, "Translation key must map to a string, but the given options will result in an object");
|
|
26878
|
+
});
|
|
26879
|
+
it("returnDetails and returnObjects throws error", () => {
|
|
26880
|
+
chai_1.assert.throws(() => {
|
|
26881
|
+
localization.getLocalizedString("X", { returnDetails: true, returnObjects: true });
|
|
26882
|
+
}, "Translation key must map to a string, but the given options will result in an object");
|
|
26883
|
+
});
|
|
26884
|
+
it("default value", () => {
|
|
26885
|
+
chai_1.assert.equal(localization.getLocalizedString("Missing", { defaultValue: "default" }), "default");
|
|
26886
|
+
});
|
|
26887
|
+
it("override fallback language", () => {
|
|
26888
|
+
// Doesn't fallback to English
|
|
26889
|
+
chai_1.assert.equal(germanLocalization.getLocalizedString("OnlyEnglish", { fallbackLng: "de" }), "OnlyEnglish");
|
|
26890
|
+
});
|
|
26891
|
+
it("set namespace", () => {
|
|
26892
|
+
chai_1.assert.equal(localization.getLocalizedString("FirstTrivial", { ns: "Test" }), "First level string (test)");
|
|
26893
|
+
chai_1.assert.equal(localization.getLocalizedString("FirstSubstitution1", { str: "CUSTOM1", ns: "Test" }), "First level CUSTOM1 (test)");
|
|
26894
|
+
});
|
|
26895
|
+
});
|
|
26896
|
+
});
|
|
26897
|
+
describe("#getLocalizedStringWithNamespace", () => {
|
|
26898
|
+
before(async () => {
|
|
26899
|
+
localization = new ITwinLocalization_1.ITwinLocalization();
|
|
26900
|
+
await localization.initialize(["Default", "Test"]);
|
|
26901
|
+
germanLocalization = new ITwinLocalization_1.ITwinLocalization({ initOptions: { lng: "de" } });
|
|
26902
|
+
await germanLocalization.initialize(["Default", "Test"]);
|
|
26903
|
+
});
|
|
26904
|
+
describe("Keys Without Namespaces", () => {
|
|
26905
|
+
it("first level with no substitution", () => {
|
|
26906
|
+
chai_1.assert.equal(localization.getLocalizedStringWithNamespace("Default", "FirstTrivial"), "First level string (default)");
|
|
26907
|
+
chai_1.assert.equal(localization.getLocalizedStringWithNamespace("Test", "FirstTrivial"), "First level string (test)");
|
|
26908
|
+
});
|
|
26909
|
+
it("first level with no substitution with fallback keys", () => {
|
|
26910
|
+
chai_1.assert.equal(localization.getLocalizedStringWithNamespace("Default", ["FirstTrivial", "NotExist"]), "First level string (default)");
|
|
26911
|
+
chai_1.assert.equal(localization.getLocalizedStringWithNamespace("Test", ["NotExist", "FirstTrivial"]), "First level string (test)");
|
|
26912
|
+
});
|
|
26913
|
+
it("second level with no substitution", () => {
|
|
26914
|
+
chai_1.assert.equal(localization.getLocalizedStringWithNamespace("Default", "SecondTrivial.Test1"), "Second level string 1 (default)");
|
|
26915
|
+
chai_1.assert.equal(localization.getLocalizedStringWithNamespace("Default", "SecondTrivial.Test2"), "Second level string 2 (default)");
|
|
26916
|
+
chai_1.assert.equal(localization.getLocalizedStringWithNamespace("Test", "SecondTrivial.Test1"), "Second level string 1 (test)");
|
|
26917
|
+
chai_1.assert.equal(localization.getLocalizedStringWithNamespace("Test", "SecondTrivial.Test2"), "Second level string 2 (test)");
|
|
26918
|
+
});
|
|
26919
|
+
it("second level with no substitution with fallback keys", () => {
|
|
26920
|
+
chai_1.assert.equal(localization.getLocalizedStringWithNamespace("Default", ["NotExist", "SecondTrivial.Test1"]), "Second level string 1 (default)");
|
|
26921
|
+
chai_1.assert.equal(localization.getLocalizedStringWithNamespace("Test", ["SecondTrivial.Test2", "NotExist"]), "Second level string 2 (test)");
|
|
26922
|
+
});
|
|
26923
|
+
it("first level with substitution", () => {
|
|
26924
|
+
chai_1.assert.equal(localization.getLocalizedStringWithNamespace("Default", "FirstSubstitution1", { str: "CUSTOM1" }), "First level CUSTOM1 (default)");
|
|
26925
|
+
chai_1.assert.equal(localization.getLocalizedStringWithNamespace("Default", "FirstSubstitution1", { str: "CUSTOM2" }), "First level CUSTOM2 (default)");
|
|
26926
|
+
chai_1.assert.equal(localization.getLocalizedStringWithNamespace("Default", "FirstSubstitution2", { str1: "CUSTOM1", str2: "CUSTOM2" }), "First level CUSTOM1 and CUSTOM2 (default)");
|
|
26927
|
+
chai_1.assert.equal(localization.getLocalizedStringWithNamespace("Test", "FirstSubstitution1", { str: "CUSTOM1" }), "First level CUSTOM1 (test)");
|
|
26928
|
+
chai_1.assert.equal(localization.getLocalizedStringWithNamespace("Test", "FirstSubstitution1", { str: "CUSTOM2" }), "First level CUSTOM2 (test)");
|
|
26929
|
+
chai_1.assert.equal(localization.getLocalizedStringWithNamespace("Test", "FirstSubstitution2", { str1: "CUSTOM1", str2: "CUSTOM2" }), "First level CUSTOM1 and CUSTOM2 (test)");
|
|
26930
|
+
});
|
|
26931
|
+
it("first level with substitution with fallback keys", () => {
|
|
26932
|
+
chai_1.assert.equal(localization.getLocalizedStringWithNamespace("Default", ["NotExist", "FirstSubstitution1"], { str: "CUSTOM1" }), "First level CUSTOM1 (default)");
|
|
26933
|
+
chai_1.assert.equal(localization.getLocalizedStringWithNamespace("Test", ["FirstSubstitution1", "NotExist"], { str: "CUSTOM2" }), "First level CUSTOM2 (test)");
|
|
26934
|
+
chai_1.assert.equal(localization.getLocalizedStringWithNamespace("Test", ["NotExist", "FirstSubstitution2"], { str1: "CUSTOM1", str2: "CUSTOM2" }), "First level CUSTOM1 and CUSTOM2 (test)");
|
|
26935
|
+
});
|
|
26936
|
+
it("second level with substitution", () => {
|
|
26937
|
+
chai_1.assert.equal(localization.getLocalizedStringWithNamespace("Default", "SecondSubstitution.Test1", { varA: "Variable1", varB: "Variable2" }), "Substitute Variable1 and Variable2 (default)");
|
|
26938
|
+
chai_1.assert.equal(localization.getLocalizedStringWithNamespace("Default", "SecondSubstitution.Test2", { varA: "Variable1", varB: "Variable2" }), "Reverse substitute Variable2 and Variable1 (default)");
|
|
26939
|
+
chai_1.assert.equal(localization.getLocalizedStringWithNamespace("Test", "SecondSubstitution.Test1", { varA: "Variable1", varB: "Variable2" }), "Substitute Variable1 and Variable2 (test)");
|
|
26940
|
+
chai_1.assert.equal(localization.getLocalizedStringWithNamespace("Test", "SecondSubstitution.Test2", { varA: "Variable1", varB: "Variable2" }), "Reverse substitute Variable2 and Variable1 (test)");
|
|
26941
|
+
});
|
|
26942
|
+
it("second level with substitution with fallback keys", () => {
|
|
26943
|
+
chai_1.assert.equal(localization.getLocalizedStringWithNamespace("Default", ["NotExist", "SecondSubstitution.Test1"], { varA: "Variable1", varB: "Variable2" }), "Substitute Variable1 and Variable2 (default)");
|
|
26944
|
+
chai_1.assert.equal(localization.getLocalizedStringWithNamespace("Test", ["SecondSubstitution.Test2", "NotExist"], { varA: "Variable1", varB: "Variable2" }), "Reverse substitute Variable2 and Variable1 (test)");
|
|
26945
|
+
});
|
|
26946
|
+
it("first level missing key doesn't find a value", () => {
|
|
26947
|
+
chai_1.assert.equal(localization.getLocalizedStringWithNamespace("Default", "MissingKeyString"), "MissingKeyString");
|
|
26948
|
+
chai_1.assert.equal(localization.getLocalizedStringWithNamespace("Test", "MissingKeyString"), "MissingKeyString");
|
|
26949
|
+
});
|
|
26950
|
+
it("second level missing key doesn't find a value", () => {
|
|
26951
|
+
chai_1.assert.equal(localization.getLocalizedStringWithNamespace("Test", "SecondTrivial.MissingString"), "SecondTrivial.MissingString");
|
|
26952
|
+
chai_1.assert.equal(localization.getLocalizedStringWithNamespace("Test", "MissingKeyObject.MissingString"), "MissingKeyObject.MissingString");
|
|
26953
|
+
});
|
|
26954
|
+
});
|
|
26955
|
+
describe("Keys Without Namespaces (German)", () => {
|
|
26956
|
+
it("first level with no substitution", () => {
|
|
26957
|
+
chai_1.assert.equal(germanLocalization.getLocalizedStringWithNamespace("Default", "FirstTrivial"), "First level string (default german)");
|
|
26958
|
+
chai_1.assert.equal(germanLocalization.getLocalizedStringWithNamespace("Test", "FirstTrivial"), "First level string (german)");
|
|
26959
|
+
});
|
|
26960
|
+
it("second level with no substitution", () => {
|
|
26961
|
+
chai_1.assert.equal(germanLocalization.getLocalizedStringWithNamespace("Default", "SecondTrivial.Test1"), "Second level string 1 (default german)");
|
|
26962
|
+
chai_1.assert.equal(germanLocalization.getLocalizedStringWithNamespace("Default", "SecondTrivial.Test2"), "Second level string 2 (default german)");
|
|
26963
|
+
chai_1.assert.equal(germanLocalization.getLocalizedStringWithNamespace("Test", "SecondTrivial.Test1"), "Second level string 1 (german)");
|
|
26964
|
+
chai_1.assert.equal(germanLocalization.getLocalizedStringWithNamespace("Test", "SecondTrivial.Test2"), "Second level string 2 (german)");
|
|
26965
|
+
});
|
|
26966
|
+
it("first level with substitution", () => {
|
|
26967
|
+
chai_1.assert.equal(germanLocalization.getLocalizedStringWithNamespace("Default", "FirstSubstitution1", { str: "CUSTOM1" }), "First level CUSTOM1 (default german)");
|
|
26968
|
+
chai_1.assert.equal(germanLocalization.getLocalizedStringWithNamespace("Default", "FirstSubstitution1", { str: "CUSTOM2" }), "First level CUSTOM2 (default german)");
|
|
26969
|
+
chai_1.assert.equal(germanLocalization.getLocalizedStringWithNamespace("Default", "FirstSubstitution2", { str1: "CUSTOM1", str2: "CUSTOM2" }), "First level CUSTOM1 and CUSTOM2 (default german)");
|
|
26970
|
+
chai_1.assert.equal(germanLocalization.getLocalizedStringWithNamespace("Test", "FirstSubstitution1", { str: "CUSTOM1" }), "First level CUSTOM1 (german)");
|
|
26971
|
+
chai_1.assert.equal(germanLocalization.getLocalizedStringWithNamespace("Test", "FirstSubstitution1", { str: "CUSTOM2" }), "First level CUSTOM2 (german)");
|
|
26972
|
+
chai_1.assert.equal(germanLocalization.getLocalizedStringWithNamespace("Test", "FirstSubstitution2", { str1: "CUSTOM1", str2: "CUSTOM2" }), "First level CUSTOM1 and CUSTOM2 (german)");
|
|
26973
|
+
});
|
|
26974
|
+
it("second level with substitution", () => {
|
|
26975
|
+
chai_1.assert.equal(germanLocalization.getLocalizedStringWithNamespace("Default", "SecondSubstitution.Test1", { varA: "Variable1", varB: "Variable2" }), "Substitute Variable1 and Variable2 (default german)");
|
|
26976
|
+
chai_1.assert.equal(germanLocalization.getLocalizedStringWithNamespace("Default", "SecondSubstitution.Test2", { varA: "Variable1", varB: "Variable2" }), "Reverse substitute Variable2 and Variable1 (default german)");
|
|
26977
|
+
chai_1.assert.equal(germanLocalization.getLocalizedStringWithNamespace("Test", "SecondSubstitution.Test1", { varA: "Variable1", varB: "Variable2" }), "Substitute Variable1 and Variable2 (german)");
|
|
26978
|
+
chai_1.assert.equal(germanLocalization.getLocalizedStringWithNamespace("Test", "SecondSubstitution.Test2", { varA: "Variable1", varB: "Variable2" }), "Reverse substitute Variable2 and Variable1 (german)");
|
|
26979
|
+
});
|
|
26980
|
+
it("first level missing key doesn't find a value", () => {
|
|
26981
|
+
chai_1.assert.equal(germanLocalization.getLocalizedStringWithNamespace("Default", "MissingKeyString"), "MissingKeyString");
|
|
26982
|
+
chai_1.assert.equal(germanLocalization.getLocalizedStringWithNamespace("Test", "MissingKeyString"), "MissingKeyString");
|
|
26983
|
+
});
|
|
26984
|
+
it("second level missing key doesn't find a value", () => {
|
|
26985
|
+
chai_1.assert.equal(germanLocalization.getLocalizedStringWithNamespace("Test", "SecondTrivial.MissingString"), "SecondTrivial.MissingString");
|
|
26986
|
+
chai_1.assert.equal(germanLocalization.getLocalizedStringWithNamespace("Test", "MissingKeyObject.MissingString"), "MissingKeyObject.MissingString");
|
|
26987
|
+
});
|
|
26988
|
+
});
|
|
26989
|
+
// Currently broken
|
|
26990
|
+
describe.skip("Keys With Namespaces", () => {
|
|
26991
|
+
it("key with same namespace works", () => {
|
|
26992
|
+
chai_1.assert.equal(localization.getLocalizedStringWithNamespace("Default", "Default:FirstTrivial"), "First level string (default)");
|
|
26993
|
+
chai_1.assert.equal(localization.getLocalizedStringWithNamespace("Test", "Test:SecondTrivial.Test1"), "Second level string 1 (test)");
|
|
26994
|
+
});
|
|
26995
|
+
it("key with different namespace overrides given namespace", () => {
|
|
26996
|
+
chai_1.assert.equal(localization.getLocalizedStringWithNamespace("Default", "Test:FirstTrivial"), "First level string (test)");
|
|
26997
|
+
chai_1.assert.equal(localization.getLocalizedStringWithNamespace("Test", "Default:FirstTrivial"), "First level string (default)");
|
|
26998
|
+
});
|
|
26999
|
+
it("key with same namespace works with fallback keys", () => {
|
|
27000
|
+
chai_1.assert.equal(localization.getLocalizedStringWithNamespace("Default", ["NotExist:FirstTrivial", "Default:FirstTrivial"]), "First level string (default)");
|
|
27001
|
+
chai_1.assert.equal(localization.getLocalizedStringWithNamespace("Test", ["NotExist:FirstTrivial", "Test:FirstTrivial"]), "First level string (test)");
|
|
27002
|
+
});
|
|
27003
|
+
it("key with different namespace overrides given namespace with fallback keys", () => {
|
|
27004
|
+
chai_1.assert.equal(localization.getLocalizedStringWithNamespace("Default", ["NotExist:FirstTrivial", "Test:FirstTrivial"]), "First level string (test)");
|
|
27005
|
+
chai_1.assert.equal(localization.getLocalizedStringWithNamespace("Test", ["NotExist:FirstTrivial", "Default:FirstTrivial"]), "First level string (default)");
|
|
27006
|
+
});
|
|
27007
|
+
it("missing key does not find a value", () => {
|
|
27008
|
+
chai_1.assert.equal(germanLocalization.getLocalizedStringWithNamespace("Default", "Default:MissingKeyString"), "MissingKeyString");
|
|
27009
|
+
chai_1.assert.equal(germanLocalization.getLocalizedStringWithNamespace("Test", ["Missing1", "MissingKeyObject.MissingString"]), "MissingKeyObject.MissingString");
|
|
27010
|
+
});
|
|
27011
|
+
});
|
|
27012
|
+
describe("Nonexisting Namespace", () => {
|
|
27013
|
+
it("first level fails", () => {
|
|
27014
|
+
chai_1.assert.equal(localization.getLocalizedStringWithNamespace("Nonexisting", "FirstTrivial"), "FirstTrivial");
|
|
27015
|
+
chai_1.assert.equal(localization.getLocalizedStringWithNamespace("Nonexisting", "MissingKeyString"), "MissingKeyString");
|
|
27016
|
+
});
|
|
27017
|
+
it("second level fails", () => {
|
|
27018
|
+
chai_1.assert.equal(localization.getLocalizedStringWithNamespace("Nonexisting", "SecondTrivial.Test1"), "SecondTrivial.Test1");
|
|
27019
|
+
chai_1.assert.equal(localization.getLocalizedStringWithNamespace("Nonexisting", "Missing.String"), "Missing.String");
|
|
27020
|
+
});
|
|
27021
|
+
// Currently broken
|
|
27022
|
+
it.skip("empty string namespace falls back to default namespace", () => {
|
|
27023
|
+
chai_1.assert.equal(localization.getLocalizedStringWithNamespace("", "FirstTrivial"), "First level string (default)");
|
|
27024
|
+
chai_1.assert.equal(localization.getLocalizedStringWithNamespace("", "SecondTrivial.Test1"), "Second level string 1 (default)");
|
|
27025
|
+
});
|
|
27026
|
+
it("fallback key fails", () => {
|
|
27027
|
+
chai_1.assert.equal(localization.getLocalizedStringWithNamespace("Nonexisting", ["FirstTrivial", "NotExist"]), "NotExist");
|
|
27028
|
+
chai_1.assert.equal(localization.getLocalizedStringWithNamespace("Nonexisting", ["NotExist", "Missing.String"]), "Missing.String");
|
|
27029
|
+
});
|
|
27030
|
+
// Currently broken
|
|
27031
|
+
it.skip("use key with valid namespace instead", () => {
|
|
27032
|
+
chai_1.assert.equal(localization.getLocalizedStringWithNamespace("Nonexisting", "Default:FirstTrivial"), "First level string (default)");
|
|
27033
|
+
chai_1.assert.equal(localization.getLocalizedStringWithNamespace("Nonexisting", "Test:FirstTrivial"), "First level string (test)");
|
|
27034
|
+
});
|
|
27035
|
+
// Currently broken
|
|
27036
|
+
it.skip("providing key with invalid namespace fails", () => {
|
|
27037
|
+
chai_1.assert.equal(localization.getLocalizedStringWithNamespace("Nonexisting1", "Nonexisting2:FirstTrivial"), "FirstTrivial");
|
|
27038
|
+
});
|
|
27039
|
+
});
|
|
27040
|
+
// Test a few options to make sure they get passed through correctly
|
|
27041
|
+
describe("With Options", () => {
|
|
27042
|
+
it("returnDetails throws error", () => {
|
|
27043
|
+
chai_1.assert.throws(() => {
|
|
27044
|
+
localization.getLocalizedStringWithNamespace("Default", "X", { returnDetails: true });
|
|
27045
|
+
}, "Translation key must map to a string, but the given options will result in an object");
|
|
27046
|
+
});
|
|
27047
|
+
it("returnObjects throws error", () => {
|
|
27048
|
+
chai_1.assert.throws(() => {
|
|
27049
|
+
localization.getLocalizedStringWithNamespace("Default", "X", { returnObjects: true });
|
|
27050
|
+
}, "Translation key must map to a string, but the given options will result in an object");
|
|
27051
|
+
});
|
|
27052
|
+
it("returnDetails and returnObjects throws error", () => {
|
|
27053
|
+
chai_1.assert.throws(() => {
|
|
27054
|
+
localization.getLocalizedStringWithNamespace("Default", "X", { returnDetails: true, returnObjects: true });
|
|
27055
|
+
}, "Translation key must map to a string, but the given options will result in an object");
|
|
27056
|
+
});
|
|
27057
|
+
it("default value", () => {
|
|
27058
|
+
chai_1.assert.equal(localization.getLocalizedStringWithNamespace("Default", "Missing", { defaultValue: "default" }), "default");
|
|
27059
|
+
});
|
|
27060
|
+
it("override fallback language", () => {
|
|
27061
|
+
// Doesn't fallback to English
|
|
27062
|
+
chai_1.assert.equal(germanLocalization.getLocalizedStringWithNamespace("Default", "OnlyEnglish", { fallbackLng: "de" }), "OnlyEnglish");
|
|
27063
|
+
});
|
|
27064
|
+
// White box test
|
|
27065
|
+
it("given namespace overrides namespace translation option", () => {
|
|
27066
|
+
chai_1.assert.equal(localization.getLocalizedStringWithNamespace("Default", "FirstTrivial", { ns: "Test" }), "First level string (default)");
|
|
27067
|
+
chai_1.assert.equal(localization.getLocalizedStringWithNamespace("Default", "FirstSubstitution1", { str: "CUSTOM1", ns: "Test" }), "First level CUSTOM1 (default)");
|
|
27068
|
+
});
|
|
27069
|
+
});
|
|
27070
|
+
});
|
|
27071
|
+
describe("#getEnglishString", () => {
|
|
27072
|
+
before(async () => {
|
|
27073
|
+
localization = new ITwinLocalization_1.ITwinLocalization();
|
|
27074
|
+
await localization.initialize(["Default", "Test"]);
|
|
27075
|
+
germanLocalization = new ITwinLocalization_1.ITwinLocalization({ initOptions: { lng: "de" } });
|
|
27076
|
+
await germanLocalization.initialize(["Default", "Test"]);
|
|
27077
|
+
});
|
|
27078
|
+
describe("Given Namespace", () => {
|
|
27079
|
+
it("first level with no substitution", () => {
|
|
27080
|
+
chai_1.assert.equal(localization.getEnglishString("Default", "FirstTrivial"), "First level string (default)");
|
|
27081
|
+
chai_1.assert.equal(localization.getEnglishString("Test", "FirstTrivial"), "First level string (test)");
|
|
27082
|
+
});
|
|
27083
|
+
it("first level with no substitution with fallback keys", () => {
|
|
27084
|
+
chai_1.assert.equal(localization.getEnglishString("Default", ["FirstTrivial", "NotExist"]), "First level string (default)");
|
|
27085
|
+
chai_1.assert.equal(localization.getEnglishString("Test", ["NotExist", "FirstTrivial"]), "First level string (test)");
|
|
27086
|
+
});
|
|
27087
|
+
it("second level with no substitution", () => {
|
|
27088
|
+
chai_1.assert.equal(localization.getEnglishString("Default", "SecondTrivial.Test1"), "Second level string 1 (default)");
|
|
27089
|
+
chai_1.assert.equal(localization.getEnglishString("Default", "SecondTrivial.Test2"), "Second level string 2 (default)");
|
|
27090
|
+
chai_1.assert.equal(localization.getEnglishString("Test", "SecondTrivial.Test1"), "Second level string 1 (test)");
|
|
27091
|
+
chai_1.assert.equal(localization.getEnglishString("Test", "SecondTrivial.Test2"), "Second level string 2 (test)");
|
|
27092
|
+
});
|
|
27093
|
+
it("second level with no substitution with fallback keys", () => {
|
|
27094
|
+
chai_1.assert.equal(localization.getEnglishString("Default", ["NotExist", "SecondTrivial.Test1"]), "Second level string 1 (default)");
|
|
27095
|
+
chai_1.assert.equal(localization.getEnglishString("Test", ["SecondTrivial.Test2", "NotExist"]), "Second level string 2 (test)");
|
|
27096
|
+
});
|
|
27097
|
+
it("first level with substitution", () => {
|
|
27098
|
+
chai_1.assert.equal(localization.getEnglishString("Default", "FirstSubstitution1", { str: "CUSTOM1" }), "First level CUSTOM1 (default)");
|
|
27099
|
+
chai_1.assert.equal(localization.getEnglishString("Default", "FirstSubstitution1", { str: "CUSTOM2" }), "First level CUSTOM2 (default)");
|
|
27100
|
+
chai_1.assert.equal(localization.getEnglishString("Default", "FirstSubstitution2", { str1: "CUSTOM1", str2: "CUSTOM2" }), "First level CUSTOM1 and CUSTOM2 (default)");
|
|
27101
|
+
chai_1.assert.equal(localization.getEnglishString("Test", "FirstSubstitution1", { str: "CUSTOM1" }), "First level CUSTOM1 (test)");
|
|
27102
|
+
chai_1.assert.equal(localization.getEnglishString("Test", "FirstSubstitution1", { str: "CUSTOM2" }), "First level CUSTOM2 (test)");
|
|
27103
|
+
chai_1.assert.equal(localization.getEnglishString("Test", "FirstSubstitution2", { str1: "CUSTOM1", str2: "CUSTOM2" }), "First level CUSTOM1 and CUSTOM2 (test)");
|
|
27104
|
+
});
|
|
27105
|
+
it("first level with substitution with fallback keys", () => {
|
|
27106
|
+
chai_1.assert.equal(localization.getEnglishString("Default", ["NotExist", "FirstSubstitution1"], { str: "CUSTOM1" }), "First level CUSTOM1 (default)");
|
|
27107
|
+
chai_1.assert.equal(localization.getEnglishString("Test", ["FirstSubstitution1", "NotExist"], { str: "CUSTOM2" }), "First level CUSTOM2 (test)");
|
|
27108
|
+
chai_1.assert.equal(localization.getEnglishString("Test", ["NotExist", "FirstSubstitution2"], { str1: "CUSTOM1", str2: "CUSTOM2" }), "First level CUSTOM1 and CUSTOM2 (test)");
|
|
27109
|
+
});
|
|
27110
|
+
it("second level with substitution", () => {
|
|
27111
|
+
chai_1.assert.equal(localization.getEnglishString("Default", "SecondSubstitution.Test1", { varA: "Variable1", varB: "Variable2" }), "Substitute Variable1 and Variable2 (default)");
|
|
27112
|
+
chai_1.assert.equal(localization.getEnglishString("Default", "SecondSubstitution.Test2", { varA: "Variable1", varB: "Variable2" }), "Reverse substitute Variable2 and Variable1 (default)");
|
|
27113
|
+
chai_1.assert.equal(localization.getEnglishString("Test", "SecondSubstitution.Test1", { varA: "Variable1", varB: "Variable2" }), "Substitute Variable1 and Variable2 (test)");
|
|
27114
|
+
chai_1.assert.equal(localization.getEnglishString("Test", "SecondSubstitution.Test2", { varA: "Variable1", varB: "Variable2" }), "Reverse substitute Variable2 and Variable1 (test)");
|
|
27115
|
+
});
|
|
27116
|
+
it("second level with substitution with fallback keys", () => {
|
|
27117
|
+
chai_1.assert.equal(localization.getEnglishString("Default", ["NotExist", "SecondSubstitution.Test1"], { varA: "Variable1", varB: "Variable2" }), "Substitute Variable1 and Variable2 (default)");
|
|
27118
|
+
chai_1.assert.equal(localization.getEnglishString("Test", ["SecondSubstitution.Test2", "NotExist"], { varA: "Variable1", varB: "Variable2" }), "Reverse substitute Variable2 and Variable1 (test)");
|
|
27119
|
+
});
|
|
27120
|
+
it("first level missing key doesn't find a value", () => {
|
|
27121
|
+
chai_1.assert.equal(localization.getEnglishString("Default", "MissingKeyString"), "MissingKeyString");
|
|
27122
|
+
chai_1.assert.equal(localization.getEnglishString("Test", "MissingKeyString"), "MissingKeyString");
|
|
27123
|
+
});
|
|
27124
|
+
it("second level missing key doesn't find a value", () => {
|
|
27125
|
+
chai_1.assert.equal(localization.getEnglishString("Test", "SecondTrivial.MissingString"), "SecondTrivial.MissingString");
|
|
27126
|
+
chai_1.assert.equal(localization.getEnglishString("Test", "MissingKeyObject.MissingString"), "MissingKeyObject.MissingString");
|
|
27127
|
+
});
|
|
27128
|
+
});
|
|
27129
|
+
describe("Given Namespace with German default language returns English strings", () => {
|
|
27130
|
+
it("first level with no substitution", () => {
|
|
27131
|
+
chai_1.assert.equal(germanLocalization.getEnglishString("Default", "FirstTrivial"), "First level string (default)");
|
|
27132
|
+
chai_1.assert.equal(germanLocalization.getEnglishString("Test", "FirstTrivial"), "First level string (test)");
|
|
27133
|
+
});
|
|
27134
|
+
it("first level with no substitution with fallback keys", () => {
|
|
27135
|
+
chai_1.assert.equal(germanLocalization.getEnglishString("Default", ["FirstTrivial", "NotExist"]), "First level string (default)");
|
|
27136
|
+
chai_1.assert.equal(germanLocalization.getEnglishString("Test", ["NotExist", "FirstTrivial"]), "First level string (test)");
|
|
27137
|
+
});
|
|
27138
|
+
it("second level with no substitution", () => {
|
|
27139
|
+
chai_1.assert.equal(germanLocalization.getEnglishString("Default", "SecondTrivial.Test1"), "Second level string 1 (default)");
|
|
27140
|
+
chai_1.assert.equal(germanLocalization.getEnglishString("Default", "SecondTrivial.Test2"), "Second level string 2 (default)");
|
|
27141
|
+
chai_1.assert.equal(germanLocalization.getEnglishString("Test", "SecondTrivial.Test1"), "Second level string 1 (test)");
|
|
27142
|
+
chai_1.assert.equal(germanLocalization.getEnglishString("Test", "SecondTrivial.Test2"), "Second level string 2 (test)");
|
|
27143
|
+
});
|
|
27144
|
+
it("second level with no substitution with fallback keys", () => {
|
|
27145
|
+
chai_1.assert.equal(germanLocalization.getEnglishString("Default", ["NotExist", "SecondTrivial.Test1"]), "Second level string 1 (default)");
|
|
27146
|
+
chai_1.assert.equal(germanLocalization.getEnglishString("Test", ["SecondTrivial.Test2", "NotExist"]), "Second level string 2 (test)");
|
|
27147
|
+
});
|
|
27148
|
+
it("first level with substitution", () => {
|
|
27149
|
+
chai_1.assert.equal(germanLocalization.getEnglishString("Default", "FirstSubstitution1", { str: "CUSTOM1" }), "First level CUSTOM1 (default)");
|
|
27150
|
+
chai_1.assert.equal(germanLocalization.getEnglishString("Default", "FirstSubstitution1", { str: "CUSTOM2" }), "First level CUSTOM2 (default)");
|
|
27151
|
+
chai_1.assert.equal(germanLocalization.getEnglishString("Default", "FirstSubstitution2", { str1: "CUSTOM1", str2: "CUSTOM2" }), "First level CUSTOM1 and CUSTOM2 (default)");
|
|
27152
|
+
chai_1.assert.equal(germanLocalization.getEnglishString("Test", "FirstSubstitution1", { str: "CUSTOM1" }), "First level CUSTOM1 (test)");
|
|
27153
|
+
chai_1.assert.equal(germanLocalization.getEnglishString("Test", "FirstSubstitution1", { str: "CUSTOM2" }), "First level CUSTOM2 (test)");
|
|
27154
|
+
chai_1.assert.equal(germanLocalization.getEnglishString("Test", "FirstSubstitution2", { str1: "CUSTOM1", str2: "CUSTOM2" }), "First level CUSTOM1 and CUSTOM2 (test)");
|
|
27155
|
+
});
|
|
27156
|
+
it("first level with substitution with fallback keys", () => {
|
|
27157
|
+
chai_1.assert.equal(germanLocalization.getEnglishString("Default", ["NotExist", "FirstSubstitution1"], { str: "CUSTOM1" }), "First level CUSTOM1 (default)");
|
|
27158
|
+
chai_1.assert.equal(germanLocalization.getEnglishString("Test", ["FirstSubstitution1", "NotExist"], { str: "CUSTOM2" }), "First level CUSTOM2 (test)");
|
|
27159
|
+
chai_1.assert.equal(germanLocalization.getEnglishString("Test", ["NotExist", "FirstSubstitution2"], { str1: "CUSTOM1", str2: "CUSTOM2" }), "First level CUSTOM1 and CUSTOM2 (test)");
|
|
27160
|
+
});
|
|
27161
|
+
it("second level with substitution", () => {
|
|
27162
|
+
chai_1.assert.equal(germanLocalization.getEnglishString("Default", "SecondSubstitution.Test1", { varA: "Variable1", varB: "Variable2" }), "Substitute Variable1 and Variable2 (default)");
|
|
27163
|
+
chai_1.assert.equal(germanLocalization.getEnglishString("Default", "SecondSubstitution.Test2", { varA: "Variable1", varB: "Variable2" }), "Reverse substitute Variable2 and Variable1 (default)");
|
|
27164
|
+
chai_1.assert.equal(germanLocalization.getEnglishString("Test", "SecondSubstitution.Test1", { varA: "Variable1", varB: "Variable2" }), "Substitute Variable1 and Variable2 (test)");
|
|
27165
|
+
chai_1.assert.equal(germanLocalization.getEnglishString("Test", "SecondSubstitution.Test2", { varA: "Variable1", varB: "Variable2" }), "Reverse substitute Variable2 and Variable1 (test)");
|
|
27166
|
+
});
|
|
27167
|
+
it("second level with substitution with fallback keys", () => {
|
|
27168
|
+
chai_1.assert.equal(germanLocalization.getEnglishString("Default", ["NotExist", "SecondSubstitution.Test1"], { varA: "Variable1", varB: "Variable2" }), "Substitute Variable1 and Variable2 (default)");
|
|
27169
|
+
chai_1.assert.equal(germanLocalization.getEnglishString("Test", ["SecondSubstitution.Test2", "NotExist"], { varA: "Variable1", varB: "Variable2" }), "Reverse substitute Variable2 and Variable1 (test)");
|
|
27170
|
+
});
|
|
27171
|
+
it("first level missing key doesn't find a value", () => {
|
|
27172
|
+
chai_1.assert.equal(germanLocalization.getEnglishString("Default", "MissingKeyString"), "MissingKeyString");
|
|
27173
|
+
chai_1.assert.equal(germanLocalization.getEnglishString("Test", "MissingKeyString"), "MissingKeyString");
|
|
27174
|
+
});
|
|
27175
|
+
it("second level missing key doesn't find a value", () => {
|
|
27176
|
+
chai_1.assert.equal(germanLocalization.getEnglishString("Test", "SecondTrivial.MissingString"), "SecondTrivial.MissingString");
|
|
27177
|
+
chai_1.assert.equal(germanLocalization.getEnglishString("Test", "MissingKeyObject.MissingString"), "MissingKeyObject.MissingString");
|
|
27178
|
+
});
|
|
27179
|
+
});
|
|
27180
|
+
describe("Nonexisting Namespace", () => {
|
|
27181
|
+
it("first level fails", () => {
|
|
27182
|
+
chai_1.assert.equal(localization.getEnglishString("Nonexisting", "FirstTrivial"), "FirstTrivial");
|
|
27183
|
+
chai_1.assert.equal(localization.getEnglishString("Nonexisting", "MissingKeyString"), "MissingKeyString");
|
|
27184
|
+
});
|
|
27185
|
+
it("second level fails", () => {
|
|
27186
|
+
chai_1.assert.equal(localization.getEnglishString("Nonexisting", "SecondTrivial.Test1"), "SecondTrivial.Test1");
|
|
27187
|
+
chai_1.assert.equal(localization.getEnglishString("Nonexisting", "Missing.String"), "Missing.String");
|
|
27188
|
+
});
|
|
27189
|
+
it("empty string namespace is treated as default namespace", () => {
|
|
27190
|
+
chai_1.assert.equal(localization.getEnglishString("", "FirstTrivial"), "First level string (default)");
|
|
27191
|
+
chai_1.assert.equal(localization.getEnglishString("", "SecondTrivial.Test1"), "Second level string 1 (default)");
|
|
27192
|
+
});
|
|
27193
|
+
});
|
|
27194
|
+
// Test a few options to make sure they get passed through correctly
|
|
27195
|
+
describe("With Options", () => {
|
|
27196
|
+
it("returnDetails throws error", () => {
|
|
27197
|
+
chai_1.assert.throws(() => {
|
|
27198
|
+
localization.getEnglishString("Default", "X", { returnDetails: true });
|
|
27199
|
+
}, "Translation key must map to a string, but the given options will result in an object");
|
|
27200
|
+
});
|
|
27201
|
+
it("returnObjects throws error", () => {
|
|
27202
|
+
chai_1.assert.throws(() => {
|
|
27203
|
+
localization.getEnglishString("Default", "X", { returnObjects: true });
|
|
27204
|
+
}, "Translation key must map to a string, but the given options will result in an object");
|
|
27205
|
+
});
|
|
27206
|
+
it("returnDetails and returnObjects throws error", () => {
|
|
27207
|
+
chai_1.assert.throws(() => {
|
|
27208
|
+
localization.getEnglishString("Default", "X", { returnDetails: true, returnObjects: true });
|
|
27209
|
+
}, "Translation key must map to a string, but the given options will result in an object");
|
|
27210
|
+
});
|
|
27211
|
+
it("default value", () => {
|
|
27212
|
+
chai_1.assert.equal(localization.getEnglishString("Default", "Missing", { defaultValue: "default" }), "default");
|
|
27213
|
+
});
|
|
27214
|
+
it("english takes priority over fallback language", () => {
|
|
27215
|
+
chai_1.assert.equal(germanLocalization.getEnglishString("Default", "OnlyEnglish", { fallbackLng: "de" }), "Hello");
|
|
27216
|
+
});
|
|
27217
|
+
// White box test
|
|
27218
|
+
it("given namespace overrides namespace translation option", () => {
|
|
27219
|
+
chai_1.assert.equal(localization.getEnglishString("Default", "FirstTrivial", { ns: "Test" }), "First level string (default)");
|
|
27220
|
+
chai_1.assert.equal(localization.getEnglishString("Default", "FirstSubstitution1", { str: "CUSTOM1", ns: "Test" }), "First level CUSTOM1 (default)");
|
|
27221
|
+
});
|
|
27222
|
+
});
|
|
27223
|
+
});
|
|
27224
|
+
// Returned promises never have anything of substance, being only empty or resolving to null...
|
|
27225
|
+
// describe("#getNamespacePromise", () => {
|
|
27226
|
+
// });
|
|
27227
|
+
describe("#getLanguageList", () => {
|
|
27228
|
+
let languages;
|
|
27229
|
+
it("english language list includes en and en-US", async () => {
|
|
27230
|
+
localization = new ITwinLocalization_1.ITwinLocalization();
|
|
27231
|
+
await localization.initialize([]);
|
|
27232
|
+
languages = localization.getLanguageList();
|
|
27233
|
+
chai_1.assert.isTrue(languages.includes("en-US"));
|
|
27234
|
+
chai_1.assert.isTrue(languages.includes("en"));
|
|
27235
|
+
});
|
|
27236
|
+
it("when non-english language is set as default, that language and english are included in langauge list", async () => {
|
|
27237
|
+
germanLocalization = new ITwinLocalization_1.ITwinLocalization({ initOptions: { lng: "de" } });
|
|
27238
|
+
await germanLocalization.initialize([]);
|
|
27239
|
+
languages = germanLocalization.getLanguageList();
|
|
27240
|
+
chai_1.assert.isTrue(languages.includes("en"));
|
|
27241
|
+
chai_1.assert.isTrue(languages.includes("de"));
|
|
27242
|
+
});
|
|
27243
|
+
});
|
|
27244
|
+
describe("#changeLanguage", () => {
|
|
27245
|
+
it("change from english to another language", async () => {
|
|
27246
|
+
localization = new ITwinLocalization_1.ITwinLocalization();
|
|
27247
|
+
await localization.initialize(["Default"]);
|
|
27248
|
+
chai_1.assert.equal(localization.getLocalizedString("FirstTrivial"), "First level string (default)"); // english
|
|
27249
|
+
await localization.changeLanguage("de");
|
|
27250
|
+
chai_1.assert.equal(localization.getLocalizedString("FirstTrivial"), "First level string (default german)"); // german
|
|
27251
|
+
});
|
|
27252
|
+
it("change from another language to english", async () => {
|
|
27253
|
+
localization = new ITwinLocalization_1.ITwinLocalization({ initOptions: { lng: "de" } });
|
|
27254
|
+
await localization.initialize(["Default"]);
|
|
27255
|
+
chai_1.assert.equal(localization.getLocalizedString("FirstTrivial"), "First level string (default german)"); // german
|
|
27256
|
+
await localization.changeLanguage("en");
|
|
27257
|
+
chai_1.assert.equal(localization.getLocalizedString("FirstTrivial"), "First level string (default)"); // english
|
|
27258
|
+
});
|
|
27259
|
+
});
|
|
27260
|
+
describe("#registerNamespace", () => {
|
|
27261
|
+
let itwinLocalization;
|
|
27262
|
+
beforeEach(async () => {
|
|
27263
|
+
itwinLocalization = new ITwinLocalization_1.ITwinLocalization();
|
|
27264
|
+
});
|
|
27265
|
+
it("can read from namespace after it is registered", async () => {
|
|
27266
|
+
await itwinLocalization.initialize([]);
|
|
27267
|
+
await itwinLocalization.registerNamespace("Test");
|
|
27268
|
+
chai_1.assert.isTrue(itwinLocalization.i18next.hasLoadedNamespace("Test"));
|
|
27269
|
+
chai_1.assert.equal(itwinLocalization.getLocalizedString("Test:FirstTrivial"), "First level string (test)");
|
|
27270
|
+
});
|
|
27271
|
+
it("zero initial, register one", async () => {
|
|
27272
|
+
await itwinLocalization.initialize([]);
|
|
27273
|
+
await itwinLocalization.registerNamespace("test1");
|
|
27274
|
+
chai_1.assert.isTrue(itwinLocalization.i18next.hasLoadedNamespace("test1"));
|
|
27275
|
+
});
|
|
27276
|
+
it("zero initial, register two", async () => {
|
|
27277
|
+
await itwinLocalization.initialize([]);
|
|
27278
|
+
await itwinLocalization.registerNamespace("test1");
|
|
27279
|
+
await itwinLocalization.registerNamespace("test2");
|
|
27280
|
+
chai_1.assert.isTrue(itwinLocalization.i18next.hasLoadedNamespace("test1"));
|
|
27281
|
+
chai_1.assert.isTrue(itwinLocalization.i18next.hasLoadedNamespace("test2"));
|
|
27282
|
+
});
|
|
27283
|
+
it("one initial, register one", async () => {
|
|
27284
|
+
await itwinLocalization.initialize(["initial1"]);
|
|
27285
|
+
await itwinLocalization.registerNamespace("test1");
|
|
27286
|
+
chai_1.assert.isTrue(itwinLocalization.i18next.hasLoadedNamespace("test1"));
|
|
27287
|
+
chai_1.assert.isTrue(itwinLocalization.i18next.hasLoadedNamespace("initial1"));
|
|
27288
|
+
});
|
|
27289
|
+
it("one initial, register two", async () => {
|
|
27290
|
+
await itwinLocalization.initialize(["initial1"]);
|
|
27291
|
+
await itwinLocalization.registerNamespace("test1");
|
|
27292
|
+
await itwinLocalization.registerNamespace("test2");
|
|
27293
|
+
chai_1.assert.isTrue(itwinLocalization.i18next.hasLoadedNamespace("test1"));
|
|
27294
|
+
chai_1.assert.isTrue(itwinLocalization.i18next.hasLoadedNamespace("test2"));
|
|
27295
|
+
chai_1.assert.isTrue(itwinLocalization.i18next.hasLoadedNamespace("initial1"));
|
|
27296
|
+
});
|
|
27297
|
+
it("two initial, register one", async () => {
|
|
27298
|
+
await itwinLocalization.initialize(["initial1", "initial2"]);
|
|
27299
|
+
await itwinLocalization.registerNamespace("test1");
|
|
27300
|
+
chai_1.assert.isTrue(itwinLocalization.i18next.hasLoadedNamespace("test1"));
|
|
27301
|
+
chai_1.assert.isTrue(itwinLocalization.i18next.hasLoadedNamespace("initial1"));
|
|
27302
|
+
chai_1.assert.isTrue(itwinLocalization.i18next.hasLoadedNamespace("initial2"));
|
|
27303
|
+
});
|
|
27304
|
+
it("two initial, register two", async () => {
|
|
27305
|
+
await itwinLocalization.initialize(["initial1", "initial2"]);
|
|
27306
|
+
await itwinLocalization.registerNamespace("test1");
|
|
27307
|
+
await itwinLocalization.registerNamespace("test2");
|
|
27308
|
+
chai_1.assert.isTrue(itwinLocalization.i18next.hasLoadedNamespace("test1"));
|
|
27309
|
+
chai_1.assert.isTrue(itwinLocalization.i18next.hasLoadedNamespace("initial1"));
|
|
27310
|
+
chai_1.assert.isTrue(itwinLocalization.i18next.hasLoadedNamespace("initial2"));
|
|
27311
|
+
});
|
|
27312
|
+
it("register duplicate namespaces", async () => {
|
|
27313
|
+
await itwinLocalization.initialize([]);
|
|
27314
|
+
await itwinLocalization.registerNamespace("Test");
|
|
27315
|
+
await itwinLocalization.registerNamespace("Test");
|
|
27316
|
+
chai_1.assert.isTrue(itwinLocalization.i18next.hasLoadedNamespace("Test"));
|
|
27317
|
+
chai_1.assert.equal(itwinLocalization.getLocalizedString("Test:FirstTrivial"), "First level string (test)");
|
|
27318
|
+
});
|
|
27319
|
+
it("register duplicate namespace of initial namespace doesn't break anything", async () => {
|
|
27320
|
+
await itwinLocalization.initialize(["Test"]);
|
|
27321
|
+
await itwinLocalization.registerNamespace("Test");
|
|
27322
|
+
chai_1.assert.isTrue(itwinLocalization.i18next.hasLoadedNamespace("Test"));
|
|
27323
|
+
chai_1.assert.equal(itwinLocalization.getLocalizedString("Test:FirstTrivial"), "First level string (test)");
|
|
26556
27324
|
});
|
|
26557
27325
|
});
|
|
27326
|
+
// unregisterNamespace() isn't used and basically does nothing
|
|
27327
|
+
// describe("#unregisterNamespace", () => {
|
|
27328
|
+
// });
|
|
26558
27329
|
});
|
|
26559
27330
|
|
|
26560
27331
|
})();
|