mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Fix help strings for the global prefs object not being localized
This commit is contained in:
parent
ace9a5f5b9
commit
ad1c02fe9d
@ -146,6 +146,12 @@ class OptionSet(object):
|
||||
self.preferences.append(pref)
|
||||
self.defaults[name] = default
|
||||
|
||||
def retranslate_help(self):
|
||||
t = _
|
||||
for opt in self.preferences:
|
||||
if opt.help:
|
||||
opt.help = t(opt.help)
|
||||
|
||||
def option_parser(self, user_defaults=None, usage='', gui_mode=False):
|
||||
from calibre.utils.config import OptionParser
|
||||
parser = OptionParser(usage, gui_mode=gui_mode)
|
||||
@ -342,6 +348,9 @@ class ConfigProxy(object):
|
||||
def refresh(self):
|
||||
self.__opts = self.__config.parse()
|
||||
|
||||
def retranslate_help(self):
|
||||
self.__config.option_set.retranslate_help()
|
||||
|
||||
def __getitem__(self, key):
|
||||
return self.get(key)
|
||||
|
||||
|
@ -137,6 +137,11 @@ def set_translators():
|
||||
t = NullTranslations()
|
||||
|
||||
t.install(unicode=True, names=('ngettext',))
|
||||
# Now that we have installed a translator, we have to retranslate the help
|
||||
# for the global prefs object as it was instantiated in get_lang(), before
|
||||
# the translator was installed.
|
||||
from calibre.utils.config_base import prefs
|
||||
prefs.retranslate_help()
|
||||
|
||||
_iso639 = None
|
||||
_extra_lang_codes = {
|
||||
|
Loading…
x
Reference in New Issue
Block a user