mirror of
https://salsa.debian.org/freeipa-team/freeipa.git
synced 2025-02-25 18:55:28 -06:00
ticket 1705 - internationalize help topics
* Wrap each topic description in _() * Replace the use of if 'topic' in dir(module) with the more Pythonic and efficient getattr(module, 'topic', None) * Make sure to invoke unicode on the value returned from _() otherwise you'll get a GettextFactory instance, not a string * Clean up trailing whitespace errors
This commit is contained in:
parent
01ea14e3f5
commit
15bf6d2f91
@ -674,10 +674,8 @@ class help(frontend.Local):
|
||||
__import__(module_name)
|
||||
module = sys.modules[module_name]
|
||||
|
||||
dir_list = dir(module)
|
||||
if 'topic' in dir_list:
|
||||
topic = module.topic
|
||||
else:
|
||||
topic = getattr(module, 'topic', None)
|
||||
if topic is None:
|
||||
topic = (self._get_command_module(module_name), None)
|
||||
|
||||
return topic
|
||||
@ -728,7 +726,7 @@ class help(frontend.Local):
|
||||
mcl = max((self._topics[topic_name][2][mod_name][1], len(c.name)))
|
||||
self._topics[topic_name][2][mod_name][1] = mcl
|
||||
else:
|
||||
self._topics[topic_name] = [topic[1], 0, {mod_name: [doc, 0, [c]]}]
|
||||
self._topics[topic_name] = [unicode(_(topic[1])), 0, {mod_name: [doc, 0, [c]]}]
|
||||
self._count_topic_mcl(topic_name, mod_name)
|
||||
else:
|
||||
self._builtins.append(c)
|
||||
|
@ -85,7 +85,7 @@ from ipalib import AccessTime, Password, Str, StrEnum
|
||||
from ipalib.plugins.baseldap import *
|
||||
from ipalib import _, ngettext
|
||||
|
||||
topic = ('hbac', 'Host-based access control commands')
|
||||
topic = ('hbac', _('Host-based access control commands'))
|
||||
|
||||
def validate_type(ugettext, type):
|
||||
if type.lower() == 'deny':
|
||||
|
@ -45,7 +45,7 @@ from ipalib.plugins.baseldap import LDAPUpdate, LDAPSearch, LDAPRetrieve
|
||||
|
||||
from ipalib import _, ngettext
|
||||
|
||||
topic = ('hbac', 'Host based access control commands')
|
||||
topic = ('hbac', _('Host based access control commands'))
|
||||
|
||||
class hbacsvc(LDAPObject):
|
||||
"""
|
||||
|
@ -45,7 +45,7 @@ from ipalib import api, errors
|
||||
from ipalib.plugins.baseldap import *
|
||||
from ipalib import _, ngettext
|
||||
|
||||
topic = ('hbac', 'Host based access control commands')
|
||||
topic = ('hbac', _('Host based access control commands'))
|
||||
|
||||
class hbacsvcgroup(LDAPObject):
|
||||
"""
|
||||
|
@ -40,7 +40,7 @@ from ipalib import Str
|
||||
from ipalib.plugins.baseldap import *
|
||||
from ipalib import _, ngettext
|
||||
|
||||
topic = ('sudo', 'commands for controlling sudo configuration')
|
||||
topic = ('sudo', _('commands for controlling sudo configuration'))
|
||||
|
||||
class sudocmd(LDAPObject):
|
||||
"""
|
||||
|
@ -44,7 +44,7 @@ from ipalib import Str
|
||||
from ipalib.plugins.baseldap import *
|
||||
from ipalib import _, ngettext
|
||||
|
||||
topic = ('sudo', 'commands for controlling sudo configuration')
|
||||
topic = ('sudo', _('commands for controlling sudo configuration'))
|
||||
|
||||
class sudocmdgroup(LDAPObject):
|
||||
"""
|
||||
|
@ -47,7 +47,7 @@ from ipalib import Str, StrEnum
|
||||
from ipalib.plugins.baseldap import *
|
||||
from ipalib import _, ngettext
|
||||
|
||||
topic = ('sudo', 'Commands for controlling sudo configuration')
|
||||
topic = ('sudo', _('Commands for controlling sudo configuration'))
|
||||
|
||||
def deprecated(attribute):
|
||||
raise errors.ValidationError(name=attribute, error=_('this option has been deprecated.'))
|
||||
|
Loading…
Reference in New Issue
Block a user