@@ -15,6 +15,7 @@ import { Node } from '../model/node.js';
15
15
import { Property , PropertyGroup , PropertyType } from '../model/property.js' ;
16
16
import { Triangle } from '../model/triangle.js' ;
17
17
import { ImporterBase } from './importerbase.js' ;
18
+ import { Loc , FLoc } from '../core/localization.js' ;
18
19
19
20
const GltfComponentType =
20
21
{
@@ -287,7 +288,7 @@ class GltfExtensions
287
288
callbacks . onSuccess ( ) ;
288
289
} ) ;
289
290
} ) . catch ( ( ) => {
290
- callbacks . onError ( 'Failed to load draco decoder.' ) ;
291
+ callbacks . onError ( Loc ( 'Failed to load draco decoder.' ) ) ;
291
292
} ) ;
292
293
} else {
293
294
callbacks . onSuccess ( ) ;
@@ -527,7 +528,7 @@ export class ImporterGltf extends ImporterBase
527
528
let textContent = ArrayBufferToUtf8String ( fileContent ) ;
528
529
let gltf = JSON . parse ( textContent ) ;
529
530
if ( gltf . asset . version !== '2.0' ) {
530
- this . SetError ( 'Invalid glTF version.' ) ;
531
+ this . SetError ( Loc ( 'Invalid glTF version.' ) ) ;
531
532
onFinish ( ) ;
532
533
return ;
533
534
}
@@ -545,7 +546,7 @@ export class ImporterGltf extends ImporterBase
545
546
}
546
547
}
547
548
if ( buffer === null ) {
548
- this . SetError ( 'One of the requested buffers is missing.' ) ;
549
+ this . SetError ( Loc ( 'One of the requested buffers is missing.' ) ) ;
549
550
onFinish ( ) ;
550
551
return ;
551
552
}
@@ -571,19 +572,19 @@ export class ImporterGltf extends ImporterBase
571
572
let reader = new BinaryReader ( fileContent , true ) ;
572
573
let magic = reader . ReadUnsignedInteger32 ( ) ;
573
574
if ( magic !== GltfConstants . GLTF_STRING ) {
574
- this . SetError ( 'Invalid glTF file.' ) ;
575
+ this . SetError ( Loc ( 'Invalid glTF file.' ) ) ;
575
576
onFinish ( ) ;
576
577
return ;
577
578
}
578
579
let version = reader . ReadUnsignedInteger32 ( ) ;
579
580
if ( version !== 2 ) {
580
- this . SetError ( 'Invalid glTF version.' ) ;
581
+ this . SetError ( Loc ( 'Invalid glTF version.' ) ) ;
581
582
onFinish ( ) ;
582
583
return ;
583
584
}
584
585
let length = reader . ReadUnsignedInteger32 ( ) ;
585
586
if ( length !== reader . GetByteLength ( ) ) {
586
- this . SetError ( 'Invalid glTF file.' ) ;
587
+ this . SetError ( Loc ( 'Invalid glTF file.' ) ) ;
587
588
onFinish ( ) ;
588
589
return ;
589
590
}
@@ -608,7 +609,7 @@ export class ImporterGltf extends ImporterBase
608
609
{
609
610
let unsupportedExtensions = this . gltfExtensions . GetUnsupportedExtensions ( gltf . extensionsRequired ) ;
610
611
if ( unsupportedExtensions . length > 0 ) {
611
- this . SetError ( 'Unsupported extension: ' + unsupportedExtensions . join ( ', ' ) + '.' ) ;
612
+ this . SetError ( FLoc ( 'Unsupported extension: {0}.' , unsupportedExtensions . join ( ', ' ) ) ) ;
612
613
onFinish ( ) ;
613
614
return ;
614
615
}
@@ -641,7 +642,7 @@ export class ImporterGltf extends ImporterBase
641
642
}
642
643
}
643
644
644
- this . ImportProperties ( this . model , gltf . asset , 'Asset properties' ) ;
645
+ this . ImportProperties ( this . model , gltf . asset , Loc ( 'Asset properties' ) ) ;
645
646
this . ImportScene ( gltf ) ;
646
647
}
647
648
@@ -809,7 +810,7 @@ export class ImporterGltf extends ImporterBase
809
810
this . ImportPrimitive ( gltf , primitive , mesh ) ;
810
811
}
811
812
812
- this . ImportProperties ( mesh , gltfMesh . extras , 'Mesh properties' ) ;
813
+ this . ImportProperties ( mesh , gltfMesh . extras , Loc ( 'Mesh properties' ) ) ;
813
814
}
814
815
815
816
ImportPrimitive ( gltf , primitive , mesh )
@@ -1006,7 +1007,7 @@ export class ImporterGltf extends ImporterBase
1006
1007
this . ImportNode ( gltf , gltfNode , rootNode ) ;
1007
1008
}
1008
1009
1009
- this . ImportProperties ( this . model , scene . extras , 'Scene properties' ) ;
1010
+ this . ImportProperties ( this . model , scene . extras , Loc ( 'Scene properties' ) ) ;
1010
1011
}
1011
1012
1012
1013
ImportNode ( gltf , gltfNode , parentNode )
@@ -1058,7 +1059,7 @@ export class ImporterGltf extends ImporterBase
1058
1059
1059
1060
if ( gltfNode . mesh !== undefined ) {
1060
1061
let mesh = this . model . GetMesh ( gltfNode . mesh ) ;
1061
- this . ImportProperties ( mesh , gltfNode . extras , 'Node properties' ) ;
1062
+ this . ImportProperties ( mesh , gltfNode . extras , Loc ( 'Node properties' ) ) ;
1062
1063
node . AddMeshIndex ( gltfNode . mesh ) ;
1063
1064
}
1064
1065
}
0 commit comments