Roundup Tracker - Issues

Message7508

Author marcus.priesch
Recipients marcus.priesch, rouilj, schlatterbeck
Date 2022-05-05.09:11:02
Message-id <0968743e-5b9b-30db-c0a8-91d6a49d20c3@priesch.co.at>
In-reply-to <1651703336.88.0.191630681504.issue2551184@roundup.psfhosted.org>
> In this code (mailgw.py:1606):
> 
>          language = self.instance.config["MAILGW_LANGUAGE"] or
> self.instance.config["TRACKER_LANGUAGE"]
>          self.db.i18n = i18n.get_language (language)
> 
> is what I copied. However i18n.get_language() isn't a valid method.
> I am not sure what i18n refers to. The mailgw.py doesn't import i18n anywhere.
> 
> Should get_language() be get_translation() (which does exist in i18n)?

uh, oh, that is not good - this was my fault - never tested the mailgw !

indeed the import is missing:

	from roundup import i18n

and indeed you need to call:

	self.db.i18n = i18n.get_translation (language)

so this is the patch for current tip:

diff -r ac0df9272162 roundup/mailgw.py
--- a/roundup/mailgw.py Tue May 03 13:16:28 2022 -0400
+++ b/roundup/mailgw.py Thu May 05 11:09:45 2022 +0200
@@ -109,6 +109,7 @@
  from roundup import configuration, hyperdb, date, password, exceptions
  from roundup.mailer import Mailer
  from roundup.i18n import _
+from roundup import i18n
  from roundup.hyperdb import iter_roles
  from roundup.anypy.strings import StringIO, b2s, u2s
  import roundup.anypy.random_ as random_
@@ -1604,7 +1605,7 @@
          self.db = self.instance.open('admin')

          language = self.instance.config["MAILGW_LANGUAGE"] or 
self.instance.config["TRACKER_LANGUAGE"]
-        self.db.i18n = i18n.get_language (language)
+        self.db.i18n = i18n.get_translation (language)

          global _
          _ = self.db.i18n.gettext

sorry,
marcus.
History
Date User Action Args
2022-05-05 09:11:02marcus.prieschsetrecipients: + marcus.priesch, schlatterbeck, rouilj
2022-05-05 09:11:02marcus.prieschlinkissue2551184 messages
2022-05-05 09:11:02marcus.prieschcreate