##// END OF EJS Templates
i18n: translate properly navList and also support proper translation into other admin views.
marcink -
r1305:b418df09 default
parent child Browse files
Show More
@@ -66,6 +66,15 b' class NavEntry(object):'
66 66 else:
67 67 return url(self.view_name)
68 68
69 def get_localized_name(self, request):
70 if hasattr(request, 'translate'):
71 return request.translate(self.name)
72 else:
73 # TODO(marcink): Remove this after migrating to pyramid
74 from pyramid.threadlocal import get_current_request
75 pyramid_request = get_current_request()
76 return pyramid_request.translate(self.name)
77
69 78
70 79 @implementer(IAdminNavigationRegistry)
71 80 class NavigationRegistry(object):
@@ -81,13 +90,11 b' class NavigationRegistry(object):'
81 90 NavEntry('hooks', _('Hooks'), 'admin_settings_hooks'),
82 91 NavEntry('search', _('Full Text Search'), 'admin_settings_search'),
83 92
84
85 93 NavEntry('integrations', _('Integrations'),
86 94 'global_integrations_home', pyramid=True),
87 NavEntry('system', _('System Info'), 'admin_settings_system'),
88
89
90 NavEntry('session', _('User Sessions'),
95 NavEntry('system', _('System Info'),
96 'admin_settings_system', pyramid=True),
97 NavEntry('sessions', _('User Sessions'),
91 98 'admin_settings_sessions', pyramid=True),
92 99 NavEntry('open_source', _('Open Source Licenses'),
93 100 'admin_settings_open_source', pyramid=True),
@@ -97,8 +104,7 b' class NavigationRegistry(object):'
97 104 # NavEntry('supervisor', _('Supervisor'), 'admin_settings_supervisor'),
98 105 ]
99 106
100 _labs_entry = NavEntry('labs', _('Labs'),
101 'admin_settings_labs')
107 _labs_entry = NavEntry('labs', _('Labs'), 'admin_settings_labs')
102 108
103 109 def __init__(self, labs_active=False):
104 110 self._registered_entries = collections.OrderedDict([
@@ -112,7 +118,8 b' class NavigationRegistry(object):'
112 118 self._registered_entries[entry.key] = entry
113 119
114 120 def get_navlist(self, request):
115 navlist = [NavListEntry(i.key, i.name, i.generate_url(request))
121 navlist = [NavListEntry(i.key, i.get_localized_name(request),
122 i.generate_url(request))
116 123 for i in self._registered_entries.values()]
117 124 return navlist
118 125
@@ -22,7 +22,6 b' import logging'
22 22
23 23 from pyramid.view import view_config
24 24
25 from rhodecode.translation import _
26 25 from rhodecode.svn_support.utils import generate_mod_dav_svn_config
27 26
28 27 from rhodecode.admin.views.base import AdminSettingsView
@@ -41,6 +40,7 b' class SvnConfigAdminSettingsView(AdminSe'
41 40 route_name='admin_settings_vcs_svn_generate_cfg',
42 41 request_method='POST', renderer='json')
43 42 def vcs_svn_generate_config(self):
43 _ = self.request.translate
44 44 try:
45 45 generate_mod_dav_svn_config(self.request.registry)
46 46 msg = {
General Comments 0
You need to be logged in to leave comments. Login now