Re: Does anybody have the mail gateway working with translations?

"John P. Rouillard" <[email protected]> Thu, 12 May 2022 11:12:19 -0400
Newsgroups gmane.comp.bug-tracking.roundup.devel
Message-ID <[email protected]>
Hi Thomas and Ralf:

In message <[email protected]>,
Thomas Arendsen Hein writes:
>* Ralf Schlatterbeck <[email protected]> [20220512 09:33]:
>> So to find out if translation works for the mail GW a test
>> with another message would be better. Has someone recently
>> tried to get a localized help-text (by sending a message with
>> the subject "help" to the tracker)?  > >The reply to "help" is
>> English, too.

Yeah, this is a tricky one. The text for this is taken from the
module's doc string: __doc__. So it should be a deferred
translation IIUC. But I am not sure how to mark it up as such (it
might be restructured text and a lot of text I am not sure if it
should).

Ralf, these messages aren't in the detectors. A number of exceptions
in mailgw.py are done using _(...)  so the translation strings are
extracted and some of them do have translations.

>And the "Failed issue tracker submission" mails contain the
>untranslated help text as well:
>
>| The node specified by the designator in the subject of your message
>| ("99999") does not exist.
>|
>| Subject was: "[issue99999] test [assignedto=doesnotexist]"

I am going to claim this is fixed thanks to Marcus' latest patch.  The
language wasn't be properly detected IIUC
(https://issues.roundup-tracker.org/issue2551184).  I did a manual
test and got translated text for this for German (de) running through
roundup/scripts/roundup_mailgw in pipe mode:

  Der in der Betreffzeile Ihre Nachricht bezeichnete Eintrag
  ("9999999") existiert nicht.

  Die Betreffzeile (Subject) war:
     '[issue9999999] testing'

using both tracker language and mailgw language settings.

I don't know if this is a good translation or not though...

I also added this as a test case to test_mailgw.py.

>|
>| Mail Gateway Help
>| =================
>| Incoming messages are examined for multiple parts:
>|...

This is still English text as discussed above.

>Not in the mailgw, but related to email: Password reset mails
>
>I have tested a roundup instance with German as default language and
>a browser requesting pages in German, the tracker shows German text,
>but the email is in English language.

Hmm, PassResetAction::handle doesn't mark those strings for
translation:

            # send the email  [for the confirmation email -- rouilj]
            tracker_name = self.db.config.TRACKER_NAME
            subject = 'Password reset for %s' % tracker_name
            body = '''
  The password has been reset for username "%(name)s".
  
  Your password is now: %(password)s
  ''' % {'name': name, 'password': newpw}

also the change request email:

    subject = 'Confirm reset of password for %s' % tracker_name

is not marked.

I think adding _() should do the trick right? Just below this block of
code is:

      self.client.add_ok_message(
          self._('Password reset and email sent to %s') % address)
      return

so _ exists.

I'll need some translations for those strings for testing
purposes.  Thomas, would you be able to update the de.po files
once I get new ones generated and into mercurial?

Also do we have translators, a number of langauges have
untranslated strings.

--
				-- rouilj
John Rouillard
===========================================================================
My employers don't acknowledge my existence much less my opinions.