i18n: expose custom name to catch the translation strings.
marcink -
r1098:5d0049e7 default
Not Reviewed
Show More
Add another comment
TODOs: 0 unresolved 0 Resolved
COMMENTS: 0 General 0 Inline
@@ -57,7 +57,7
57 super(PermissionsController, self).__before__()
57 super(PermissionsController, self).__before__()
58
58
59 def __load_data(self):
59 def __load_data(self):
60 PermissionModel().set_global_permission_choices(c, translator=_)
60 PermissionModel().set_global_permission_choices(c, gettext_translator=_)
61
61
62 @HasPermissionAllDecorator('hg.admin')
62 @HasPermissionAllDecorator('hg.admin')
63 def permission_application(self):
63 def permission_application(self):
@@ -65,7 +65,7
65 def __before__(self):
65 def __before__(self):
66 super(UserGroupsController, self).__before__()
66 super(UserGroupsController, self).__before__()
67 c.available_permissions = config['available_permissions']
67 c.available_permissions = config['available_permissions']
68 PermissionModel().set_global_permission_choices(c, translator=_)
68 PermissionModel().set_global_permission_choices(c, gettext_translator=_)
69
69
70 def __load_data(self, user_group_id):
70 def __load_data(self, user_group_id):
71 c.group_members_obj = [x.user for x in c.user_group.members]
71 c.group_members_obj = [x.user for x in c.user_group.members]
@@ -74,7 +74,7
74 ('ru', 'Russian (ru)'),
74 ('ru', 'Russian (ru)'),
75 ('zh', 'Chinese (zh)'),
75 ('zh', 'Chinese (zh)'),
76 ]
76 ]
77 PermissionModel().set_global_permission_choices(c, translator=_)
77 PermissionModel().set_global_permission_choices(c, gettext_translator=_)
78
78
79 @HasPermissionAllDecorator('hg.admin')
79 @HasPermissionAllDecorator('hg.admin')
80 def index(self):
80 def index(self):
@@ -61,62 +61,63
61 'default_user_group_perm': None,
61 'default_user_group_perm': None,
62 }
62 }
63
63
64 def set_global_permission_choices(self, c_obj, translator):
64 def set_global_permission_choices(self, c_obj, gettext_translator):
65
65 c_obj.repo_perms_choices = [
66 c_obj.repo_perms_choices = [
66 ('repository.none', translator('None'),),
67 ('repository.none', gettext_translator('None'),),
67 ('repository.read', translator('Read'),),
68 ('repository.read', gettext_translator('Read'),),
68 ('repository.write', translator('Write'),),
69 ('repository.write', gettext_translator('Write'),),
69 ('repository.admin', translator('Admin'),)]
70 ('repository.admin', gettext_translator('Admin'),)]
70
71
71 c_obj.group_perms_choices = [
72 c_obj.group_perms_choices = [
72 ('group.none', translator('None'),),
73 ('group.none', gettext_translator('None'),),
73 ('group.read', translator('Read'),),
74 ('group.read', gettext_translator('Read'),),
74 ('group.write', translator('Write'),),
75 ('group.write', gettext_translator('Write'),),
75 ('group.admin', translator('Admin'),)]
76 ('group.admin', gettext_translator('Admin'),)]
76
77
77 c_obj.user_group_perms_choices = [
78 c_obj.user_group_perms_choices = [
78 ('usergroup.none', translator('None'),),
79 ('usergroup.none', gettext_translator('None'),),
79 ('usergroup.read', translator('Read'),),
80 ('usergroup.read', gettext_translator('Read'),),
80 ('usergroup.write', translator('Write'),),
81 ('usergroup.write', gettext_translator('Write'),),
81 ('usergroup.admin', translator('Admin'),)]
82 ('usergroup.admin', gettext_translator('Admin'),)]
82
83
83 c_obj.register_choices = [
84 c_obj.register_choices = [
84 ('hg.register.none', translator('Disabled')),
85 ('hg.register.none', gettext_translator('Disabled')),
85 ('hg.register.manual_activate', translator('Allowed with manual account activation')),
86 ('hg.register.manual_activate', gettext_translator('Allowed with manual account activation')),
86 ('hg.register.auto_activate', translator('Allowed with automatic account activation')),]
87 ('hg.register.auto_activate', gettext_translator('Allowed with automatic account activation')),]
87
88
88 c_obj.password_reset_choices = [
89 c_obj.password_reset_choices = [
89 ('hg.password_reset.enabled', translator('Allow password recovery')),
90 ('hg.password_reset.enabled', gettext_translator('Allow password recovery')),
90 ('hg.password_reset.hidden', translator('Hide password recovery link')),
91 ('hg.password_reset.hidden', gettext_translator('Hide password recovery link')),
91 ('hg.password_reset.disabled', translator('Disable password recovery')),]
92 ('hg.password_reset.disabled', gettext_translator('Disable password recovery')),]
92
93
93 c_obj.extern_activate_choices = [
94 c_obj.extern_activate_choices = [
94 ('hg.extern_activate.manual', translator('Manual activation of external account')),
95 ('hg.extern_activate.manual', gettext_translator('Manual activation of external account')),
95 ('hg.extern_activate.auto', translator('Automatic activation of external account')),]
96 ('hg.extern_activate.auto', gettext_translator('Automatic activation of external account')),]
96
97
97 c_obj.repo_create_choices = [
98 c_obj.repo_create_choices = [
98 ('hg.create.none', translator('Disabled')),
99 ('hg.create.none', gettext_translator('Disabled')),
99 ('hg.create.repository', translator('Enabled'))]
100 ('hg.create.repository', gettext_translator('Enabled'))]
100
101
101 c_obj.repo_create_on_write_choices = [
102 c_obj.repo_create_on_write_choices = [
102 ('hg.create.write_on_repogroup.false', translator('Disabled')),
103 ('hg.create.write_on_repogroup.false', gettext_translator('Disabled')),
103 ('hg.create.write_on_repogroup.true', translator('Enabled'))]
104 ('hg.create.write_on_repogroup.true', gettext_translator('Enabled'))]
104
105
105 c_obj.user_group_create_choices = [
106 c_obj.user_group_create_choices = [
106 ('hg.usergroup.create.false', translator('Disabled')),
107 ('hg.usergroup.create.false', gettext_translator('Disabled')),
107 ('hg.usergroup.create.true', translator('Enabled'))]
108 ('hg.usergroup.create.true', gettext_translator('Enabled'))]
108
109
109 c_obj.repo_group_create_choices = [
110 c_obj.repo_group_create_choices = [
110 ('hg.repogroup.create.false', translator('Disabled')),
111 ('hg.repogroup.create.false', gettext_translator('Disabled')),
111 ('hg.repogroup.create.true', translator('Enabled'))]
112 ('hg.repogroup.create.true', gettext_translator('Enabled'))]
112
113
113 c_obj.fork_choices = [
114 c_obj.fork_choices = [
114 ('hg.fork.none', translator('Disabled')),
115 ('hg.fork.none', gettext_translator('Disabled')),
115 ('hg.fork.repository', translator('Enabled'))]
116 ('hg.fork.repository', gettext_translator('Enabled'))]
116
117
117 c_obj.inherit_default_permission_choices = [
118 c_obj.inherit_default_permission_choices = [
118 ('hg.inherit_default_perms.false', translator('Disabled')),
119 ('hg.inherit_default_perms.false', gettext_translator('Disabled')),
119 ('hg.inherit_default_perms.true', translator('Enabled'))]
120 ('hg.inherit_default_perms.true', gettext_translator('Enabled'))]
120
121
121 def get_default_perms(self, object_perms, suffix):
122 def get_default_perms(self, object_perms, suffix):
122 defaults = {}
123 defaults = {}
@@ -21,6 +21,7
21 lazy_ugettext
21 lazy_ugettext
22 _ngettext
22 _ngettext
23 _gettext
23 _gettext
24 gettext_translator
24
25
25 [init_catalog]
26 [init_catalog]
26 domain = rhodecode
27 domain = rhodecode
Comments 0
You need to be logged in to leave comments. Login now