@@ -140,7 +140,7 @@ class TagNodeRef {
140140 else value = `${ this . service . tagging . ns ( originalNs ) } :${ value } ` ;
141141 }
142142 this . node . innerHTML = value ;
143- this . node . setAttribute ( 'lang' , 'cmn-Hans ' ) ;
143+ this . node . setAttribute ( 'lang' , 'zh-hans ' ) ;
144144 return true ;
145145 }
146146}
@@ -308,7 +308,7 @@ export class Syringe {
308308 node . classList . add ( 'ehs-translate-tag' ) ;
309309 }
310310 if ( this . config . translateUi ) {
311- node . setAttribute ( 'lang' , 'cmn-Hans ' ) ;
311+ node . setAttribute ( 'lang' , 'zh-hans ' ) ;
312312 } else {
313313 node . setAttribute ( 'lang' , 'en' ) ;
314314 }
@@ -325,7 +325,7 @@ export class Syringe {
325325
326326 const handled = this . translateTag ( node ) ;
327327 /* tag 处理过的ui不再处理*/
328- if ( ! handled && this . config . translateUi ) {
328+ if ( ! handled && ( this . config . translateUi || this . config . translateTimestamp ) ) {
329329 this . translateUi ( node ) ;
330330 }
331331 }
@@ -382,17 +382,20 @@ export class Syringe {
382382 }
383383
384384 private translateUiText ( text : string ) : string | undefined {
385- const plain = this . uiData . plainReplacements . get ( text ) ;
386- if ( plain != null ) return plain ;
387-
388385 let repText = text ;
389- for ( const [ k , v ] of this . uiData . regexReplacements ) {
390- // eslint-disable-next-line @typescript-eslint/no-explicit-any
391- repText = repText . replace ( k , v as ( substring : string , ...args : any [ ] ) => string ) ;
386+
387+ if ( this . config . translateUi ) {
388+ const plain = this . uiData . plainReplacements . get ( text ) ;
389+ if ( plain != null ) return plain ;
390+
391+ for ( const [ k , v ] of this . uiData . regexReplacements ) {
392+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
393+ repText = repText . replace ( k , v as ( substring : string , ...args : any [ ] ) => string ) ;
394+ }
392395 }
393396
394397 if (
395- this . config . translateTimestamp !== false &&
398+ this . config . translateTimestamp &&
396399 // 快速判断是否有可能包含时间戳
397400 repText . includes ( ':' )
398401 ) {
@@ -486,7 +489,7 @@ export class Syringe {
486489 }
487490
488491 if ( isElement ( node , 'p' ) && node . classList . contains ( 'gpc' ) ) {
489- /* 兼容熊猫书签,单独处理页码,保留原页码Element ,防止熊猫书签取不到报错 */
492+ /* 兼容熊猫书签,单独处理页码,保留原页码 Element ,防止熊猫书签取不到报错 */
490493 this . cloneAndPrependElement ( node ) ;
491494 }
492495
0 commit comments