Fix help strings for the global prefs object not being localized

This commit is contained in:
Kovid Goyal 2013-11-29 08:20:55 +05:30
parent ace9a5f5b9
commit ad1c02fe9d
2 changed files with 14 additions and 0 deletions

View File

@ -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)

View File

@ -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 = {