@@ -224,15 +224,28 @@ class ReplyWithHeader {
224
224
rwhLogger . debug ( textLines ) ;
225
225
226
226
let locale = await rwhSettings . getHeaderLocale ( ) ;
227
+ rwhLogger . debug ( 'locale -' , locale ) ;
228
+
227
229
let startPos = 0 ;
228
230
let linesToDelete = 1 ;
229
231
if ( this . isReply ) {
230
- let r = this . _findPlainTextReplyInsertMarker ( textLines , rwhI18n . i18n [ 'wrote' ] [ locale ] ) ;
231
- if ( r . found ) {
232
- startPos = r . startPos ;
233
- } else { // fallback
234
- r = this . _findPlainTextReplyInsertMarker ( textLines , rwhI18n . i18n [ 'wrote' ] [ 'en-US' ] ) ;
235
- startPos = r . found ? r . startPos : 0 ;
232
+ // Reply insert marker by fallback order
233
+ var lookupValues = new Array (
234
+ rwhI18n . i18n [ 'wrote' ] [ locale ] ,
235
+ rwhI18n . i18n [ 'wrote' ] [ 'en-US' ] ,
236
+ rwhI18n . i18n [ 'originalMessage' ] [ locale ] ,
237
+ rwhI18n . i18n [ 'originalMessage' ] [ 'en-US' ] ,
238
+ ) ;
239
+ rwhLogger . debug ( 'lookupValues -' , lookupValues ) ;
240
+
241
+ for ( let idx in lookupValues ) {
242
+ let v = lookupValues [ idx ] ;
243
+ let r = this . _findPlainTextReplyInsertMarker ( textLines , v ) ;
244
+ if ( r . found ) {
245
+ rwhLogger . debug ( `Found by the index: ${ idx } value: ${ v } ` ) ;
246
+ startPos = r . startPos ;
247
+ break ;
248
+ }
236
249
}
237
250
} else if ( this . isForward ) {
238
251
linesToDelete = rwhHeaders . length ;
@@ -244,8 +257,9 @@ class ReplyWithHeader {
244
257
}
245
258
}
246
259
260
+ rwhLogger . debug ( 'startPos -' , startPos ) ;
247
261
if ( startPos > 0 ) {
248
- rwhLogger . debug ( 'startPos' , startPos , textLines [ startPos ] ) ;
262
+ rwhLogger . debug ( 'textLines: ' , textLines [ startPos ] ) ;
249
263
textLines . splice ( startPos , linesToDelete , ...rwhHeaders ) ;
250
264
}
251
265
0 commit comments