@@ -112,43 +112,38 @@ export class LanguageSpecificLabeler {
112112
113113 const language = ( await this . detectLanguage ( translationChunk ) ) ?. toLowerCase ( ) ;
114114 safeLog ( 'Detected language:' , language ?? 'undefined' ) ;
115- if ( ! language ) {
115+ if ( ! language || language === 'en' ) {
116116 const languagelabel = issue . labels . find ( ( label ) =>
117117 label . startsWith ( this . translatorRequestedLabelPrefix ) ,
118118 ) ;
119119 if ( languagelabel ) await this . issue . removeLabel ( languagelabel ) ;
120120 await this . issue . removeLabel ( this . englishPleaseLabel ) ;
121121 await this . issue . removeLabel ( this . needsMoreInfoLabel ) ;
122122 } else if ( language ) {
123- // check again, another bot may have commented in the mean time.
124- for await ( const page of this . issue . getComments ( ) ) {
125- for ( const comment of page ) {
126- if ( comment . body . includes ( '<!-- translation_requested_comment -->' ) ) {
127- return ;
128- }
129- }
130- }
131-
132- if ( this . needsMoreInfoLabel ) await this . issue . addLabel ( this . needsMoreInfoLabel ) ;
133- const englishComment = knownTranslations [ 'en' ] ;
134- if ( language === 'en' ) {
135- // Contents could be a mix of en and other languages, no need to translate but leave a comment for the user
136- await this . issue . postComment ( `${ englishComment } \n<!-- translation_requested_comment -->` ) ;
137- return ;
138- }
139-
140123 const label = this . translatorRequestedLabelPrefix + commonNames [ language ] ;
141124 if ( ! ( await this . issue . repoHasLabel ( label ) ) ) {
142125 safeLog ( 'Globally creating label ' + label ) ;
143126 await this . issue . createLabel ( label , this . translatorRequestedLabelColor , '' ) ;
144127 }
145128 await this . issue . addLabel ( label ) ;
129+ if ( this . needsMoreInfoLabel ) await this . issue . addLabel ( this . needsMoreInfoLabel ) ;
146130
147131 const targetLanguageComment =
148132 knownTranslations [ language ] ??
149133 ( await this . translate ( baseString , language ) ) ??
150134 'ERR_TRANSLATION_FAILED' ;
151135
136+ const englishComment = knownTranslations [ 'en' ] ;
137+
138+ // check again, another bot may have commented in the mean time.
139+ for await ( const page of this . issue . getComments ( ) ) {
140+ for ( const comment of page ) {
141+ if ( comment . body . includes ( '<!-- translation_requested_comment -->' ) ) {
142+ return ;
143+ }
144+ }
145+ }
146+
152147 await this . issue . postComment (
153148 `${ targetLanguageComment } \n\n---\n${ englishComment } \n<!-- translation_requested_comment -->` ,
154149 ) ;
0 commit comments