Skip to content

Commit 134958f

Browse files
authored
Fix localization texts that contain semicolon (#2900)
1 parent 4725f91 commit 134958f

File tree

3 files changed

+7
-3
lines changed

3 files changed

+7
-3
lines changed

modules/templates/helper.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,10 @@ func NewFuncMap() []template.FuncMap {
160160
return setting.DisableGitHooks
161161
},
162162
"TrN": TrN,
163+
// TODO: Remove this once go-ini parser supports unescaping comment characters
164+
"UnescapeLocale": func(str string) string {
165+
return strings.NewReplacer("\\;", ";", "\\#", "#").Replace(str)
166+
},
163167
}}
164168
}
165169

options/locale/locale_en-US.ini

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -627,8 +627,8 @@ issues.label_templates.info = There are not any labels yet. You can click on the
627627
issues.label_templates.helper = Select a label set
628628
issues.label_templates.use = Use this label set
629629
issues.label_templates.fail_to_load_file = Failed to load label template file '%s': %v
630-
issues.add_label_at = `added the <div class="ui label" style="color: %s; background-color: %s">%s</div> label %s`
631-
issues.remove_label_at = `removed the <div class="ui label" style="color: %s; background-color: %s">%s</div> label %s`
630+
issues.add_label_at = `added the <div class="ui label" style="color: %s\; background-color: %s">%s</div> label %s`
631+
issues.remove_label_at = `removed the <div class="ui label" style="color: %s\; background-color: %s">%s</div> label %s`
632632
issues.add_milestone_at = `added this to the <b>%s</b> milestone %s`
633633
issues.change_milestone_at = `modified the milestone from <b>%s</b> to <b>%s</b> %s`
634634
issues.remove_milestone_at = `removed this from the <b>%s</b> milestone %s`

templates/repo/issue/view_content/comments.tmpl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@
9696
<img src="{{.Poster.RelAvatarLink}}">
9797
</a>
9898
<span class="text grey"><a href="{{.Poster.HomeLink}}">{{.Poster.Name}}</a>
99-
{{if .Content}}{{$.i18n.Tr "repo.issues.add_label_at" .Label.ForegroundColor .Label.Color .Label.Name $createdStr | Safe}}{{else}}{{$.i18n.Tr "repo.issues.remove_label_at" .Label.ForegroundColor .Label.Color .Label.Name $createdStr | Safe}}{{end}}</span>
99+
{{if .Content}}{{$.i18n.Tr "repo.issues.add_label_at" .Label.ForegroundColor .Label.Color .Label.Name $createdStr | UnescapeLocale | Safe}}{{else}}{{$.i18n.Tr "repo.issues.remove_label_at" .Label.ForegroundColor .Label.Color .Label.Name $createdStr | UnescapeLocale | Safe}}{{end}}</span>
100100
</div>
101101
{{end}}
102102
{{else if eq .Type 8}}

0 commit comments

Comments
 (0)