##// 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 else:
66 else:
67 return url(self.view_name)
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 @implementer(IAdminNavigationRegistry)
79 @implementer(IAdminNavigationRegistry)
71 class NavigationRegistry(object):
80 class NavigationRegistry(object):
@@ -81,13 +90,11 b' class NavigationRegistry(object):'
81 NavEntry('hooks', _('Hooks'), 'admin_settings_hooks'),
90 NavEntry('hooks', _('Hooks'), 'admin_settings_hooks'),
82 NavEntry('search', _('Full Text Search'), 'admin_settings_search'),
91 NavEntry('search', _('Full Text Search'), 'admin_settings_search'),
83
92
84
85 NavEntry('integrations', _('Integrations'),
93 NavEntry('integrations', _('Integrations'),
86 'global_integrations_home', pyramid=True),
94 'global_integrations_home', pyramid=True),
87 NavEntry('system', _('System Info'), 'admin_settings_system'),
95 NavEntry('system', _('System Info'),
88
96 'admin_settings_system', pyramid=True),
89
97 NavEntry('sessions', _('User Sessions'),
90 NavEntry('session', _('User Sessions'),
91 'admin_settings_sessions', pyramid=True),
98 'admin_settings_sessions', pyramid=True),
92 NavEntry('open_source', _('Open Source Licenses'),
99 NavEntry('open_source', _('Open Source Licenses'),
93 'admin_settings_open_source', pyramid=True),
100 'admin_settings_open_source', pyramid=True),
@@ -97,8 +104,7 b' class NavigationRegistry(object):'
97 # NavEntry('supervisor', _('Supervisor'), 'admin_settings_supervisor'),
104 # NavEntry('supervisor', _('Supervisor'), 'admin_settings_supervisor'),
98 ]
105 ]
99
106
100 _labs_entry = NavEntry('labs', _('Labs'),
107 _labs_entry = NavEntry('labs', _('Labs'), 'admin_settings_labs')
101 'admin_settings_labs')
102
108
103 def __init__(self, labs_active=False):
109 def __init__(self, labs_active=False):
104 self._registered_entries = collections.OrderedDict([
110 self._registered_entries = collections.OrderedDict([
@@ -112,7 +118,8 b' class NavigationRegistry(object):'
112 self._registered_entries[entry.key] = entry
118 self._registered_entries[entry.key] = entry
113
119
114 def get_navlist(self, request):
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 for i in self._registered_entries.values()]
123 for i in self._registered_entries.values()]
117 return navlist
124 return navlist
118
125
@@ -22,7 +22,6 b' import logging'
22
22
23 from pyramid.view import view_config
23 from pyramid.view import view_config
24
24
25 from rhodecode.translation import _
26 from rhodecode.svn_support.utils import generate_mod_dav_svn_config
25 from rhodecode.svn_support.utils import generate_mod_dav_svn_config
27
26
28 from rhodecode.admin.views.base import AdminSettingsView
27 from rhodecode.admin.views.base import AdminSettingsView
@@ -41,6 +40,7 b' class SvnConfigAdminSettingsView(AdminSe'
41 route_name='admin_settings_vcs_svn_generate_cfg',
40 route_name='admin_settings_vcs_svn_generate_cfg',
42 request_method='POST', renderer='json')
41 request_method='POST', renderer='json')
43 def vcs_svn_generate_config(self):
42 def vcs_svn_generate_config(self):
43 _ = self.request.translate
44 try:
44 try:
45 generate_mod_dav_svn_config(self.request.registry)
45 generate_mod_dav_svn_config(self.request.registry)
46 msg = {
46 msg = {
General Comments 0
You need to be logged in to leave comments. Login now