comparison roundup/admin.py @ 6658:408fd477761f

Add i18n object to roundupdb.Database This makes the i18n object accessible everywhere (including in detectors where localized error messages were impossible). See issue2551184
author Ralf Schlatterbeck <rsc@runtux.com>
date Tue, 03 May 2022 14:51:59 +0200
parents d4371b131c9c
children 00fe67eb8a91
comparison
equal deleted inserted replaced
6657:2453d7b58a92 6658:408fd477761f
28 from roundup import date, hyperdb, init, password, token 28 from roundup import date, hyperdb, init, password, token
29 from roundup import __version__ as roundup_version 29 from roundup import __version__ as roundup_version
30 import roundup.instance 30 import roundup.instance
31 from roundup.configuration import (CoreConfig, NoConfigError, 31 from roundup.configuration import (CoreConfig, NoConfigError,
32 ParsingOptionError, UserConfig) 32 ParsingOptionError, UserConfig)
33 from roundup.i18n import _ 33 from roundup.i18n import _, get_translation
34 from roundup.exceptions import UsageError 34 from roundup.exceptions import UsageError
35 from roundup.anypy.my_input import my_input 35 from roundup.anypy.my_input import my_input
36 from roundup.anypy.strings import repr_export 36 from roundup.anypy.strings import repr_export
37 37
38 try: 38 try:
1717 return 1 1717 return 1
1718 1718
1719 # only open the database once! 1719 # only open the database once!
1720 if not self.db: 1720 if not self.db:
1721 self.db = tracker.open(self.name) 1721 self.db = tracker.open(self.name)
1722 # dont use tracker.config["TRACKER_LANGUAGE"] here as the
1723 # cli operator likely wants to have i18n as set in the
1724 # environment.
1725 # This is needed to fetch the locale's of the tracker's home dir.
1726 self.db.i18n = get_translation (tracker_home = tracker.tracker_home)
1722 1727
1723 self.db.tx_Source = 'cli' 1728 self.db.tx_Source = 'cli'
1724 1729
1725 # do the command 1730 # do the command
1726 ret = 0 1731 ret = 0

Roundup Issue Tracker: http://roundup-tracker.org/