@@ -23,7 +23,7 @@ function recursiveFlatten(prefix, data) {
23
23
...recursiveFlatten ( prefix + key + "." , data [ key ] ) ,
24
24
} ;
25
25
} else {
26
- output [ prefix + key ] = data [ key ] . replace ( / ' { / g, "''{" ) . replace ( / } ' / g, "}''" ) ;
26
+ output [ prefix + key ] = String ( data [ key ] ) . replace ( / ' { / g, "''{" ) . replace ( / } ' / g, "}''" ) ;
27
27
}
28
28
} ) ;
29
29
return Object . fromEntries ( Object . entries ( output ) . sort ( ) ) ;
@@ -37,21 +37,21 @@ gulp.task("generate-translations", async function (task) {
37
37
) ;
38
38
39
39
for ( const language of fs . readdirSync ( paths . translations_src ) ) {
40
- if ( ignoredLanguages . has ( language ) ) continue ;
41
40
const lang = language . split ( "." ) [ 0 ] ;
42
- const fileName = lang in changeLang ? changeLang [ lang ] : lang ;
41
+ if ( ignoredLanguages . has ( language ) ) continue ;
42
+ const fileName = `${ lang in changeLang ? changeLang [ lang ] : lang } .json` ;
43
43
const translation = { ...defaultTranslation } ;
44
- if ( language !== "en" && fs . existsSync ( `${ paths . translations_src } /${ fileName } ` ) ) {
44
+ if ( lang !== "en" && fs . existsSync ( `${ paths . translations_src } /${ language } ` ) ) {
45
45
const fileTranslations = recursiveFlatten (
46
46
"" ,
47
- fs . readJSONSync ( `${ paths . translations_src } /${ fileName } ` , "utf-8" )
47
+ fs . readJSONSync ( `${ paths . translations_src } /${ language } ` , "utf-8" )
48
48
) ;
49
49
for ( const key of Object . keys ( fileTranslations ) ) {
50
50
translation [ key ] = fileTranslations [ key ] ;
51
51
}
52
52
}
53
53
await fs . writeFile (
54
- `${ paths . build_dir } /translations/${ language } ` ,
54
+ `${ paths . build_dir } /translations/${ fileName } ` ,
55
55
JSON . stringify ( translation , null ) ,
56
56
"utf-8"
57
57
) ;
0 commit comments