Translation in roundup-admin does not include tracker_home/locale

John Rouillard via Roundup-devel <[email protected]> Sat, 16 Mar 2024 11:31:14 -0400
Newsgroups gmane.comp.bug-tracking.roundup.devel
Message-ID <CANfx4ms8qrVKC6yJVJYuDEUZyPEkBsjAGGrw2Dy09UPbZYVNXg@mail.gmail.com>
Hi all:

Bern and Ralf, do you guys have an issue with translations in the
tracker_home/locale directory not working in roundup-admin?

I am just finishing up some work to make the roundup-admin history
command human readable. As part of that I am adding translatable
strings.  I am adding the strings to tracker_home/locale/de.po and
putting some translation in so I can see that it works.

However these strings are not being translated.

I think i18n is called early in the loading of roundup-admin, before
the tracker is opened. So the translation object I am getting doesn't
include the tracker's locale directory.

I have two passes through i18n::get_translation one with the call
stack (removing frozen libs):

  roundup/scripts/roundup_admin.py(40)<module>()
-> from roundup.admin import AdminTool

  roundup/admin.py(34)<module>()
-> import roundup.instance

  roundup/instance.py(44)<module>()
-> from roundup import configuration, mailgw

  roundup.sysadmin/roundup/configuration.py(20)<module>()
-> import roundup.date

  roundup/date.py(41)<module>()
-> from roundup import i18n

  roundup/i18n.py(244)<module>()
-> translation = get_translation()

> roundup/i18n.py(198)get_translation()

it doesn't have tracker_home set. If I set a breakpoint in
get_translation and manually set tracker_home, I do see the
translation.

The second call to get_translation has tracker_home set properly with
the following stack:

  roundup/scripts/roundup_admin.py(40)<module>()
-> from roundup.admin import AdminTool

  roundup/scripts/roundup_admin.py(50)run()
-> sys.exit(tool.main())

  roundup/admin.py(2370)main()
-> ret = self.run_command(args)

  roundup/admin.py(2234)run_command()
-> self.db.i18n = get_translation(tracker_home=tracker.tracker_home)

> roundup/i18n.py(198)get_translation()
-> mofiles = []

So it looks like _() is initialized too early and the db's i18n is
correctly initialized. Trying to set _() to self.db.i18n doesn't seem
to make a difference.

AFAICT, the locale files installed in the roundup software directory
are properly found and used. It's just the ones under the tracker home
that are not used.

Do you guys (or anybody else with i81n knowledge) have an idea here?

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