From 134958fd9f40b96384bc76598409a4a6fa032708 Mon Sep 17 00:00:00 2001 From: Lauris BH Date: Mon, 13 Nov 2017 09:56:10 +0200 Subject: [PATCH] Fix localization texts that contain semicolon (#2900) --- modules/templates/helper.go | 4 ++++ options/locale/locale_en-US.ini | 4 ++-- templates/repo/issue/view_content/comments.tmpl | 2 +- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/modules/templates/helper.go b/modules/templates/helper.go index 454bd648a3..ae2efc2585 100644 --- a/modules/templates/helper.go +++ b/modules/templates/helper.go @@ -160,6 +160,10 @@ func NewFuncMap() []template.FuncMap { return setting.DisableGitHooks }, "TrN": TrN, + // TODO: Remove this once go-ini parser supports unescaping comment characters + "UnescapeLocale": func(str string) string { + return strings.NewReplacer("\\;", ";", "\\#", "#").Replace(str) + }, }} } diff --git a/options/locale/locale_en-US.ini b/options/locale/locale_en-US.ini index 86b64946c2..59c4d840ee 100644 --- a/options/locale/locale_en-US.ini +++ b/options/locale/locale_en-US.ini @@ -627,8 +627,8 @@ issues.label_templates.info = There are not any labels yet. You can click on the issues.label_templates.helper = Select a label set issues.label_templates.use = Use this label set issues.label_templates.fail_to_load_file = Failed to load label template file '%s': %v -issues.add_label_at = `added the
%s
label %s` -issues.remove_label_at = `removed the
%s
label %s` +issues.add_label_at = `added the
%s
label %s` +issues.remove_label_at = `removed the
%s
label %s` issues.add_milestone_at = `added this to the %s milestone %s` issues.change_milestone_at = `modified the milestone from %s to %s %s` issues.remove_milestone_at = `removed this from the %s milestone %s` diff --git a/templates/repo/issue/view_content/comments.tmpl b/templates/repo/issue/view_content/comments.tmpl index 34609ceb31..083518dffe 100644 --- a/templates/repo/issue/view_content/comments.tmpl +++ b/templates/repo/issue/view_content/comments.tmpl @@ -96,7 +96,7 @@ {{.Poster.Name}} - {{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}} + {{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}} {{end}} {{else if eq .Type 8}}