@@ -3782,6 +3782,7 @@ def testNoSubjectErrorTranslation(self):
37823782 self .instance .config ['TRACKER_HOME' ])
37833783
37843784 _ = self .db .i18n .gettext
3785+ old_translate_ = mailgw ._
37853786 roundupdb ._ = mailgw ._ = _
37863787
37873788 self .db .tx_Source = "email"
@@ -3795,6 +3796,7 @@ def testNoSubjectErrorTranslation(self):
37953796
37963797 self .assertEqual (str (ctx .exception ), "me me me" )
37973798
3799+ roundupdb ._ = mailgw ._ = old_translate_
37983800
37993801 def testNoSubjectErrorTranslationDe (self ):
38003802 """ Use message with no subject to trigger an error get output in
@@ -3825,6 +3827,7 @@ def testNoSubjectErrorTranslationDe(self):
38253827 self .instance .config ['TRACKER_HOME' ])
38263828
38273829 _ = self .db .i18n .gettext
3830+ old_translate_ = mailgw ._
38283831 roundupdb ._ = mailgw ._ = _
38293832
38303833 self .db .tx_Source = "email"
@@ -3837,6 +3840,72 @@ def testNoSubjectErrorTranslationDe(self):
38373840
38383841 self .assertEqual (str (ctx .exception ), de_translation )
38393842
3843+ roundupdb ._ = mailgw ._ = old_translate_
3844+
3845+ def testNoIssueClassErrorTranslationDe (self ):
3846+ """ Use message with a non-existant issue designator
3847+ to trigger an error get output in German. """
3848+
3849+ message = '''Content-Type: text/plain;
3850+ charset="iso-8859-1"
3851+ 3852+ 3853+ Message-Id: <dummy_test_message_id_2>
3854+ Subject: [issue9999999] this is a nonexistant issue
3855+
3856+ Just a test reply
3857+ '''
3858+ print (self .db .config .MAILGW_LANGUAGE , self .db .config .TRACKER_LANGUAGE )
3859+ # verify proper value when no translation
3860+ self .db .config .MAILGW_LANGUAGE = 'de'
3861+ self .db .config .TRACKER_LANGUAGE = 'de'
3862+ print (self .db .config .MAILGW_LANGUAGE , self .db .config .TRACKER_LANGUAGE )
3863+
3864+ ### copied from mailgw.py handle_message()
3865+ language = self .instance .config ["MAILGW_LANGUAGE" ] or self .instance .config ["TRACKER_LANGUAGE" ]
3866+ # use . as tracker home to get .mo files from top level
3867+ # locale directory.
3868+ self .assertEqual ('de' , language )
3869+ print (i18n .DOMAIN )
3870+
3871+ self .db .i18n = i18n .get_translation (language ,
3872+ self .instance .config ['TRACKER_HOME' ])
3873+
3874+ _ = self .db .i18n .gettext
3875+ old_translate_ = mailgw ._
3876+ roundupdb ._ = mailgw ._ = _
3877+
3878+ self .db .tx_Source = "email"
3879+ ### end copy
3880+
3881+ de_translation = "Der in der Betreffzeile Ihre Nachricht bezeichnete Eintrag"
3882+
3883+ with self .assertRaises (MailUsageError ) as ctx :
3884+ self ._handle_mail (message )
3885+
3886+ self .assertIn (de_translation , str (ctx .exception ))
3887+
3888+ de_translation = """Der Betreff muss einen Klassennamen oder Bezeichner enthalten, um
3889+ anzuzeigen, worum es geht. Zum Beispiel:
3890+ """
3891+ with self .assertRaises (MailUsageError ) as ctx :
3892+ self ._handle_mail (
3893+ '''Content-Type: text/plain;
3894+ charset="iso-8859-1"
3895+ 3896+ 3897+ Subject: [frobulated] testing
3898+ 3899+ 3900+ Message-Id: <dummy_test_message_id>
3901+
3902+ ''' )
3903+
3904+ self .assertIn (de_translation , str (ctx .exception ))
3905+
3906+
3907+ roundupdb ._ = mailgw ._ = old_translate_
3908+
38403909 #
38413910 # TEST FOR INVALID DESIGNATOR HANDLING
38423911 #
0 commit comments