Skip to content

Commit 7960ba7

Browse files
authored
Always use ctx.Locale.Tr inside templates (#27231)
1 parent e6d8b14 commit 7960ba7

File tree

305 files changed

+3816
-3816
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

305 files changed

+3816
-3816
lines changed

templates/admin/applications/list.tmpl

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{{template "admin/layout_head" (dict "ctxData" . "pageClass" "admin config")}}
22
<div class="admin-setting-content">
33
<h4 class="ui top attached header">
4-
{{.locale.Tr "settings.applications"}}
4+
{{ctx.Locale.Tr "settings.applications"}}
55
</h4>
66
{{template "user/settings/applications_oauth2_list" .}}
77
</div>

templates/admin/auth/edit.tmpl

+94-94
Large diffs are not rendered by default.

templates/admin/auth/list.tmpl

+8-8
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,22 @@
11
{{template "admin/layout_head" (dict "ctxData" . "pageClass" "admin authentication")}}
22
<div class="admin-setting-content">
33
<h4 class="ui top attached header">
4-
{{.locale.Tr "admin.auths.auth_manage_panel"}} ({{.locale.Tr "admin.total" .Total}})
4+
{{ctx.Locale.Tr "admin.auths.auth_manage_panel"}} ({{.locale.Tr "admin.total" .Total}})
55
<div class="ui right">
6-
<a class="ui primary tiny button" href="{{AppSubUrl}}/admin/auths/new">{{.locale.Tr "admin.auths.new"}}</a>
6+
<a class="ui primary tiny button" href="{{AppSubUrl}}/admin/auths/new">{{ctx.Locale.Tr "admin.auths.new"}}</a>
77
</div>
88
</h4>
99
<div class="ui attached table segment">
1010
<table class="ui very basic striped table unstackable">
1111
<thead>
1212
<tr>
1313
<th>ID</th>
14-
<th>{{.locale.Tr "admin.auths.name"}}</th>
15-
<th>{{.locale.Tr "admin.auths.type"}}</th>
16-
<th>{{.locale.Tr "admin.auths.enabled"}}</th>
17-
<th>{{.locale.Tr "admin.auths.updated"}}</th>
18-
<th>{{.locale.Tr "admin.users.created"}}</th>
19-
<th>{{.locale.Tr "admin.users.edit"}}</th>
14+
<th>{{ctx.Locale.Tr "admin.auths.name"}}</th>
15+
<th>{{ctx.Locale.Tr "admin.auths.type"}}</th>
16+
<th>{{ctx.Locale.Tr "admin.auths.enabled"}}</th>
17+
<th>{{ctx.Locale.Tr "admin.auths.updated"}}</th>
18+
<th>{{ctx.Locale.Tr "admin.users.created"}}</th>
19+
<th>{{ctx.Locale.Tr "admin.users.edit"}}</th>
2020
</tr>
2121
</thead>
2222
<tbody>

templates/admin/auth/new.tmpl

+28-28
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
{{template "admin/layout_head" (dict "ctxData" . "pageClass" "admin new authentication")}}
22
<div class="admin-setting-content">
33
<h4 class="ui top attached header">
4-
{{.locale.Tr "admin.auths.new"}}
4+
{{ctx.Locale.Tr "admin.auths.new"}}
55
</h4>
66
<div class="ui attached segment">
77
<form class="ui form" action="{{.Link}}" method="post">
88
{{template "base/disable_form_autofill"}}
99
{{.CsrfTokenHtml}}
1010
<!-- Types and name -->
1111
<div class="inline required field {{if .Err_Type}}error{{end}}">
12-
<label>{{.locale.Tr "admin.auths.auth_type"}}</label>
12+
<label>{{ctx.Locale.Tr "admin.auths.auth_type"}}</label>
1313
<div class="ui selection type dropdown">
1414
<input type="hidden" id="auth_type" name="type" value="{{.type}}">
1515
<div class="text">{{.CurrentTypeName}}</div>
@@ -22,7 +22,7 @@
2222
</div>
2323
</div>
2424
<div class="required inline field {{if .Err_Name}}error{{end}}">
25-
<label for="auth_name">{{.locale.Tr "admin.auths.auth_name"}}</label>
25+
<label for="auth_name">{{ctx.Locale.Tr "admin.auths.auth_name"}}</label>
2626
<input id="auth_name" name="name" value="{{.name}}" autofocus required>
2727
</div>
2828

@@ -34,16 +34,16 @@
3434

3535
<!-- PAM -->
3636
<div class="pam required field {{if not (eq .type 4)}}gt-hidden{{end}}">
37-
<label for="pam_service_name">{{.locale.Tr "admin.auths.pam_service_name"}}</label>
37+
<label for="pam_service_name">{{ctx.Locale.Tr "admin.auths.pam_service_name"}}</label>
3838
<input id="pam_service_name" name="pam_service_name" value="{{.pam_service_name}}">
39-
<label for="pam_email_domain">{{.locale.Tr "admin.auths.pam_email_domain"}}</label>
39+
<label for="pam_email_domain">{{ctx.Locale.Tr "admin.auths.pam_email_domain"}}</label>
4040
<input id="pam_email_domain" name="pam_email_domain" value="{{.pam_email_domain}}">
4141
</div>
4242
<div class="pam optional field {{if not (eq .type 4)}}gt-hidden{{end}}">
4343
<div class="ui checkbox">
44-
<label for="skip_local_two_fa"><strong>{{.locale.Tr "admin.auths.skip_local_two_fa"}}</strong></label>
44+
<label for="skip_local_two_fa"><strong>{{ctx.Locale.Tr "admin.auths.skip_local_two_fa"}}</strong></label>
4545
<input id="skip_local_two_fa" name="skip_local_two_fa" type="checkbox" {{if .skip_local_two_fa}}checked{{end}}>
46-
<p class="help">{{.locale.Tr "admin.auths.skip_local_two_fa_helper"}}</p>
46+
<p class="help">{{ctx.Locale.Tr "admin.auths.skip_local_two_fa_helper"}}</p>
4747
</div>
4848
</div>
4949

@@ -55,67 +55,67 @@
5555

5656
<div class="ldap field">
5757
<div class="ui checkbox">
58-
<label><strong>{{.locale.Tr "admin.auths.attributes_in_bind"}}</strong></label>
58+
<label><strong>{{ctx.Locale.Tr "admin.auths.attributes_in_bind"}}</strong></label>
5959
<input name="attributes_in_bind" type="checkbox" {{if .attributes_in_bind}}checked{{end}}>
6060
</div>
6161
</div>
6262
<div class="ldap inline field {{if not (eq .type 2)}}gt-hidden{{end}}">
6363
<div class="ui checkbox">
64-
<label><strong>{{.locale.Tr "admin.auths.syncenabled"}}</strong></label>
64+
<label><strong>{{ctx.Locale.Tr "admin.auths.syncenabled"}}</strong></label>
6565
<input name="is_sync_enabled" type="checkbox" {{if .is_sync_enabled}}checked{{end}}>
6666
</div>
6767
</div>
6868
<div class="inline field">
6969
<div class="ui checkbox">
70-
<label><strong>{{.locale.Tr "admin.auths.activated"}}</strong></label>
70+
<label><strong>{{ctx.Locale.Tr "admin.auths.activated"}}</strong></label>
7171
<input name="is_active" type="checkbox" {{if .is_active}}checked{{end}}>
7272
</div>
7373
</div>
7474

7575
<div class="field">
76-
<button class="ui primary button">{{.locale.Tr "admin.auths.new"}}</button>
76+
<button class="ui primary button">{{ctx.Locale.Tr "admin.auths.new"}}</button>
7777
</div>
7878
</form>
7979
</div>
8080

8181
<h4 class="ui top attached header">
82-
{{.locale.Tr "admin.auths.tips"}}
82+
{{ctx.Locale.Tr "admin.auths.tips"}}
8383
</h4>
8484
<div class="ui attached segment">
8585
<h5>GMail Settings:</h5>
8686
<p>Host: smtp.gmail.com, Port: 587, Enable TLS Encryption: true</p>
8787

88-
<h5 class="oauth2">{{.locale.Tr "admin.auths.tips.oauth2.general"}}:</h5>
89-
<p class="oauth2">{{.locale.Tr "admin.auths.tips.oauth2.general.tip"}} <b id="oauth2-callback-url"></b></p>
88+
<h5 class="oauth2">{{ctx.Locale.Tr "admin.auths.tips.oauth2.general"}}:</h5>
89+
<p class="oauth2">{{ctx.Locale.Tr "admin.auths.tips.oauth2.general.tip"}} <b id="oauth2-callback-url"></b></p>
9090

91-
<h5 class="ui top attached header">{{.locale.Tr "admin.auths.tip.oauth2_provider"}}</h5>
91+
<h5 class="ui top attached header">{{ctx.Locale.Tr "admin.auths.tip.oauth2_provider"}}</h5>
9292
<div class="ui attached segment">
9393
<li>Bitbucket</li>
94-
<span>{{.locale.Tr "admin.auths.tip.bitbucket"}}</span>
94+
<span>{{ctx.Locale.Tr "admin.auths.tip.bitbucket"}}</span>
9595
<li>Dropbox</li>
96-
<span>{{.locale.Tr "admin.auths.tip.dropbox"}}</span>
96+
<span>{{ctx.Locale.Tr "admin.auths.tip.dropbox"}}</span>
9797
<li>Facebook</li>
98-
<span>{{.locale.Tr "admin.auths.tip.facebook"}}</span>
98+
<span>{{ctx.Locale.Tr "admin.auths.tip.facebook"}}</span>
9999
<li>GitHub</li>
100-
<span>{{.locale.Tr "admin.auths.tip.github"}}</span>
100+
<span>{{ctx.Locale.Tr "admin.auths.tip.github"}}</span>
101101
<li>GitLab</li>
102-
<span>{{.locale.Tr "admin.auths.tip.gitlab"}}</span>
102+
<span>{{ctx.Locale.Tr "admin.auths.tip.gitlab"}}</span>
103103
<li>Google</li>
104-
<span>{{.locale.Tr "admin.auths.tip.google_plus"}}</span>
104+
<span>{{ctx.Locale.Tr "admin.auths.tip.google_plus"}}</span>
105105
<li>OpenID Connect</li>
106-
<span>{{.locale.Tr "admin.auths.tip.openid_connect"}}</span>
106+
<span>{{ctx.Locale.Tr "admin.auths.tip.openid_connect"}}</span>
107107
<li>Twitter</li>
108-
<span>{{.locale.Tr "admin.auths.tip.twitter"}}</span>
108+
<span>{{ctx.Locale.Tr "admin.auths.tip.twitter"}}</span>
109109
<li>Discord</li>
110-
<span>{{.locale.Tr "admin.auths.tip.discord"}}</span>
110+
<span>{{ctx.Locale.Tr "admin.auths.tip.discord"}}</span>
111111
<li>Gitea</li>
112-
<span>{{.locale.Tr "admin.auths.tip.gitea"}}</span>
112+
<span>{{ctx.Locale.Tr "admin.auths.tip.gitea"}}</span>
113113
<li>Nextcloud</li>
114-
<span>{{.locale.Tr "admin.auths.tip.nextcloud"}}</span>
114+
<span>{{ctx.Locale.Tr "admin.auths.tip.nextcloud"}}</span>
115115
<li>Yandex</li>
116-
<span>{{.locale.Tr "admin.auths.tip.yandex"}}</span>
116+
<span>{{ctx.Locale.Tr "admin.auths.tip.yandex"}}</span>
117117
<li>Mastodon</li>
118-
<span>{{.locale.Tr "admin.auths.tip.mastodon"}}</span>
118+
<span>{{ctx.Locale.Tr "admin.auths.tip.mastodon"}}</span>
119119
</div>
120120
</div>
121121
</div>

templates/admin/auth/source/ldap.tmpl

+31-31
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<div class="ldap dldap field {{if not (or (eq .type 2) (eq .type 5))}}gt-hidden{{end}}">
22
<div class="inline required field {{if .Err_SecurityProtocol}}error{{end}}">
3-
<label>{{.locale.Tr "admin.auths.security_protocol"}}</label>
3+
<label>{{ctx.Locale.Tr "admin.auths.security_protocol"}}</label>
44
<div class="ui selection security-protocol dropdown">
55
<input type="hidden" id="security_protocol" name="security_protocol" value="{{.security_protocol}}">
66
<div class="text">{{.CurrentSecurityProtocol}}</div>
@@ -13,128 +13,128 @@
1313
</div>
1414
</div>
1515
<div class="required field">
16-
<label for="host">{{.locale.Tr "admin.auths.host"}}</label>
16+
<label for="host">{{ctx.Locale.Tr "admin.auths.host"}}</label>
1717
<input id="host" name="host" value="{{.host}}" placeholder="mydomain.com">
1818
</div>
1919
<div class="required field">
20-
<label for="port">{{.locale.Tr "admin.auths.port"}}</label>
20+
<label for="port">{{ctx.Locale.Tr "admin.auths.port"}}</label>
2121
<input id="port" name="port" value="{{.port}}" placeholder="636">
2222
</div>
2323
<div class="has-tls inline field {{if not .HasTLS}}gt-hidden{{end}}">
2424
<div class="ui checkbox">
25-
<label><strong>{{.locale.Tr "admin.auths.skip_tls_verify"}}</strong></label>
25+
<label><strong>{{ctx.Locale.Tr "admin.auths.skip_tls_verify"}}</strong></label>
2626
<input name="skip_verify" type="checkbox" {{if .skip_verify}}checked{{end}}>
2727
</div>
2828
</div>
2929
<div class="ldap field {{if not (eq .type 2)}}gt-hidden{{end}}">
30-
<label for="bind_dn">{{.locale.Tr "admin.auths.bind_dn"}}</label>
30+
<label for="bind_dn">{{ctx.Locale.Tr "admin.auths.bind_dn"}}</label>
3131
<input id="bind_dn" name="bind_dn" value="{{.bind_dn}}" placeholder="cn=Search,dc=mydomain,dc=com">
3232
</div>
3333
<div class="ldap field {{if not (eq .type 2)}}gt-hidden{{end}}">
34-
<label for="bind_password">{{.locale.Tr "admin.auths.bind_password"}}</label>
34+
<label for="bind_password">{{ctx.Locale.Tr "admin.auths.bind_password"}}</label>
3535
<input id="bind_password" name="bind_password" type="password" autocomplete="off" value="{{.bind_password}}">
3636
</div>
3737
<div class="binddnrequired {{if (eq .type 2)}}required{{end}} field">
38-
<label for="user_base">{{.locale.Tr "admin.auths.user_base"}}</label>
38+
<label for="user_base">{{ctx.Locale.Tr "admin.auths.user_base"}}</label>
3939
<input id="user_base" name="user_base" value="{{.user_base}}" placeholder="ou=Users,dc=mydomain,dc=com">
4040
</div>
4141
<div class="dldap required field {{if not (eq .type 5)}}gt-hidden{{end}}">
42-
<label for="user_dn">{{.locale.Tr "admin.auths.user_dn"}}</label>
42+
<label for="user_dn">{{ctx.Locale.Tr "admin.auths.user_dn"}}</label>
4343
<input id="user_dn" name="user_dn" value="{{.user_dn}}" placeholder="uid=%s,ou=Users,dc=mydomain,dc=com">
4444
</div>
4545
<div class="required field">
46-
<label for="filter">{{.locale.Tr "admin.auths.filter"}}</label>
46+
<label for="filter">{{ctx.Locale.Tr "admin.auths.filter"}}</label>
4747
<input id="filter" name="filter" value="{{.filter}}" placeholder="(&(objectClass=posixAccount)(|(uid=%[1]s)(mail=%[1]s)))">
4848
</div>
4949
<div class="field">
50-
<label for="admin_filter">{{.locale.Tr "admin.auths.admin_filter"}}</label>
50+
<label for="admin_filter">{{ctx.Locale.Tr "admin.auths.admin_filter"}}</label>
5151
<input id="admin_filter" name="admin_filter" value="{{.admin_filter}}">
5252
</div>
5353
<div class="field">
54-
<label for="restricted_filter">{{.locale.Tr "admin.auths.restricted_filter"}}</label>
54+
<label for="restricted_filter">{{ctx.Locale.Tr "admin.auths.restricted_filter"}}</label>
5555
<input id="restricted_filter" name="restricted_filter" value="{{.restricted_filter}}">
56-
<p class="help">{{.locale.Tr "admin.auths.restricted_filter_helper"}}</p>
56+
<p class="help">{{ctx.Locale.Tr "admin.auths.restricted_filter_helper"}}</p>
5757
</div>
5858
<div class="field">
59-
<label for="attribute_username">{{.locale.Tr "admin.auths.attribute_username"}}</label>
60-
<input id="attribute_username" name="attribute_username" value="{{.attribute_username}}" placeholder="{{.locale.Tr "admin.auths.attribute_username_placeholder"}}">
59+
<label for="attribute_username">{{ctx.Locale.Tr "admin.auths.attribute_username"}}</label>
60+
<input id="attribute_username" name="attribute_username" value="{{.attribute_username}}" placeholder="{{ctx.Locale.Tr "admin.auths.attribute_username_placeholder"}}">
6161
</div>
6262
<div class="field">
63-
<label for="attribute_name">{{.locale.Tr "admin.auths.attribute_name"}}</label>
63+
<label for="attribute_name">{{ctx.Locale.Tr "admin.auths.attribute_name"}}</label>
6464
<input id="attribute_name" name="attribute_name" value="{{.attribute_name}}">
6565
</div>
6666
<div class="field">
67-
<label for="attribute_surname">{{.locale.Tr "admin.auths.attribute_surname"}}</label>
67+
<label for="attribute_surname">{{ctx.Locale.Tr "admin.auths.attribute_surname"}}</label>
6868
<input id="attribute_surname" name="attribute_surname" value="{{.attribute_surname}}">
6969
</div>
7070
<div class="required field">
71-
<label for="attribute_mail">{{.locale.Tr "admin.auths.attribute_mail"}}</label>
71+
<label for="attribute_mail">{{ctx.Locale.Tr "admin.auths.attribute_mail"}}</label>
7272
<input id="attribute_mail" name="attribute_mail" value="{{.attribute_mail}}" placeholder="mail">
7373
</div>
7474
<div class="field">
75-
<label for="attribute_ssh_public_key">{{.locale.Tr "admin.auths.attribute_ssh_public_key"}}</label>
75+
<label for="attribute_ssh_public_key">{{ctx.Locale.Tr "admin.auths.attribute_ssh_public_key"}}</label>
7676
<input id="attribute_ssh_public_key" name="attribute_ssh_public_key" value="{{.attribute_ssh_public_key}}" placeholder="SshPublicKey">
7777
</div>
7878
<div class="field">
79-
<label for="attribute_avatar">{{.locale.Tr "admin.auths.attribute_avatar"}}</label>
79+
<label for="attribute_avatar">{{ctx.Locale.Tr "admin.auths.attribute_avatar"}}</label>
8080
<input id="attribute_avatar" name="attribute_avatar" value="{{.attribute_avatar}}" placeholder="jpegPhoto">
8181
</div>
8282

8383
<!-- ldap group begin -->
8484
<div class="inline field">
8585
<div class="ui checkbox">
86-
<label><strong>{{.locale.Tr "admin.auths.enable_ldap_groups"}}</strong></label>
86+
<label><strong>{{ctx.Locale.Tr "admin.auths.enable_ldap_groups"}}</strong></label>
8787
<input type="checkbox" name="groups_enabled" class="js-ldap-group-toggle" {{if .groups_enabled}}checked{{end}}>
8888
</div>
8989
</div>
9090
<div id="ldap-group-options" class="ui segment secondary">
9191
<div class="field">
92-
<label>{{.locale.Tr "admin.auths.group_search_base"}}</label>
92+
<label>{{ctx.Locale.Tr "admin.auths.group_search_base"}}</label>
9393
<input name="group_dn" value="{{.group_dn}}" placeholder="ou=group,dc=mydomain,dc=com">
9494
</div>
9595
<div class="field">
96-
<label>{{.locale.Tr "admin.auths.group_attribute_list_users"}}</label>
96+
<label>{{ctx.Locale.Tr "admin.auths.group_attribute_list_users"}}</label>
9797
<input name="group_member_uid" value="{{.group_member_uid}}" placeholder="memberUid">
9898
</div>
9999
<div class="field">
100-
<label>{{.locale.Tr "admin.auths.user_attribute_in_group"}}</label>
100+
<label>{{ctx.Locale.Tr "admin.auths.user_attribute_in_group"}}</label>
101101
<input name="user_uid" value="{{.user_uid}}" placeholder="uid">
102102
</div>
103103
<div class="field">
104-
<label>{{.locale.Tr "admin.auths.verify_group_membership"}}</label>
104+
<label>{{ctx.Locale.Tr "admin.auths.verify_group_membership"}}</label>
105105
<input name="group_filter" value="{{.group_filter}}" placeholder="(|(cn=gitea_users)(cn=admins))">
106106
</div>
107107
<div class="field">
108-
<label>{{.locale.Tr "admin.auths.map_group_to_team"}}</label>
108+
<label>{{ctx.Locale.Tr "admin.auths.map_group_to_team"}}</label>
109109
<textarea name="group_team_map" rows="5" placeholder='{"cn=my-group,cn=groups,dc=example,dc=org": {"MyGiteaOrganization": ["MyGiteaTeam1", "MyGiteaTeam2"]}}'>{{.group_team_map}}</textarea>
110110
</div>
111111
<div class="ui checkbox">
112-
<label>{{.locale.Tr "admin.auths.map_group_to_team_removal"}}</label>
112+
<label>{{ctx.Locale.Tr "admin.auths.map_group_to_team_removal"}}</label>
113113
<input name="group_team_map_removal" type="checkbox" {{if .group_team_map_removal}}checked{{end}}>
114114
</div>
115115
</div>
116116
<!-- ldap group end -->
117117

118118
<div class="ldap inline field {{if not (eq .type 2)}}gt-hidden{{end}}">
119119
<div class="ui checkbox">
120-
<label for="use_paged_search"><strong>{{.locale.Tr "admin.auths.use_paged_search"}}</strong></label>
120+
<label for="use_paged_search"><strong>{{ctx.Locale.Tr "admin.auths.use_paged_search"}}</strong></label>
121121
<input id="use_paged_search" name="use_paged_search" class="use-paged-search" type="checkbox" {{if .use_paged_search}}checked{{end}}>
122122
</div>
123123
</div>
124124
<div class="ldap field search-page-size required {{if or (not (eq .type 2)) (not .use_paged_search)}}gt-hidden{{end}}">
125-
<label for="search_page_size">{{.locale.Tr "admin.auths.search_page_size"}}</label>
125+
<label for="search_page_size">{{ctx.Locale.Tr "admin.auths.search_page_size"}}</label>
126126
<input id="search_page_size" name="search_page_size" value="{{.search_page_size}}">
127127
</div>
128128
<div class="optional field">
129129
<div class="ui checkbox">
130-
<label for="skip_local_two_fa"><strong>{{.locale.Tr "admin.auths.skip_local_two_fa"}}</strong></label>
130+
<label for="skip_local_two_fa"><strong>{{ctx.Locale.Tr "admin.auths.skip_local_two_fa"}}</strong></label>
131131
<input id="skip_local_two_fa" name="skip_local_two_fa" type="checkbox" {{if .skip_local_two_fa}}checked{{end}}>
132-
<p class="help">{{.locale.Tr "admin.auths.skip_local_two_fa_helper"}}</p>
132+
<p class="help">{{ctx.Locale.Tr "admin.auths.skip_local_two_fa_helper"}}</p>
133133
</div>
134134
</div>
135135
<div class="inline field">
136136
<div class="ui checkbox">
137-
<label for="allow_deactivate_all"><strong>{{.locale.Tr "admin.auths.allow_deactivate_all"}}</strong></label>
137+
<label for="allow_deactivate_all"><strong>{{ctx.Locale.Tr "admin.auths.allow_deactivate_all"}}</strong></label>
138138
<input id="allow_deactivate_all" name="allow_deactivate_all" type="checkbox" {{if .allow_deactivate_all}}checked{{end}}>
139139
</div>
140140
</div>

0 commit comments

Comments
 (0)