@@ -406,7 +406,7 @@ const schedule_eval = (name, ms, ...rest) => {
406
406
parts [ part ] . content = value ;
407
407
global [ part + '_value' ] = value ;
408
408
}
409
- eval ( code )
409
+ eval ( code ) ;
410
410
} ,
411
411
+ ms
412
412
)
@@ -473,7 +473,6 @@ const runGeneration = async (lang) => {
473
473
474
474
const html = genHtml ( parts ) ;
475
475
const hash = crypto . createHash ( 'sha1' ) . update ( html ) . digest ( 'base64url' ) ;
476
- await fs . writeFile ( `${ FRAMES_DIR } /_index111.html` , html )
477
476
frameHashByAbsIndex [ cntr ] = hash ;
478
477
479
478
if ( ! frameAbsIndexByHTMLHash [ hash ] ) {
@@ -526,11 +525,24 @@ const runGeneration = async (lang) => {
526
525
await fs . mkdir ( FRAMES_DIR , { recursive : true } ) ;
527
526
528
527
const processed_lines = [ ]
529
- for ( const line of script . split ( '\n' ) ) {
528
+ for ( const lineIter of script . split ( '\n' ) ) {
529
+ let line = lineIter ;
530
530
if ( ! line . trim ( ) || line . trim ( ) . startsWith ( ';' ) ) {
531
531
// empty line
532
532
continue ;
533
533
}
534
+ if ( lang !== 'default' ) {
535
+ const strings = translationsDict [ lang ] ;
536
+ Object . keys ( strings ) . forEach ( ( tr ) => {
537
+ // not tested but should prevent from b64 strigs to be affected by translations
538
+ // withUniquifiedIDs = withUniquifiedIDs.replace(new RegExp(`>(.+?)${tr}(.+?)<`, 'g'), (_, v1, mid, v2) => {
539
+ // return `>${v1}${strings[tr]}${v2}<`;
540
+ // });
541
+ // allows to translate constants in script too
542
+ line = line . replaceAll ( `'${ tr } '` , `'${ strings [ tr ] } '` ) . replaceAll ( `"${ tr } "` , `"${ strings [ tr ] } "` ) ;
543
+ } ) ;
544
+ }
545
+
534
546
if ( line . trim ( ) . startsWith ( '&&' ) ) {
535
547
processed_lines [ processed_lines . length - 1 ] += ` ${ line . trim ( ) } ` ;
536
548
} else {
0 commit comments