diff --git a/models/project/project.go b/models/project/project.go
index e39c0568857cd..44609e60b2ea0 100644
--- a/models/project/project.go
+++ b/models/project/project.go
@@ -6,7 +6,6 @@ package project
import (
"context"
"fmt"
- "html"
"code.gitea.io/gitea/models/db"
repo_model "code.gitea.io/gitea/models/repo"
@@ -14,7 +13,6 @@ import (
"code.gitea.io/gitea/modules/log"
"code.gitea.io/gitea/modules/setting"
"code.gitea.io/gitea/modules/timeutil"
- "code.gitea.io/gitea/modules/translation"
"code.gitea.io/gitea/modules/util"
"xorm.io/builder"
@@ -161,21 +159,6 @@ func (p *Project) IsRepositoryProject() bool {
return p.Type == TypeRepository
}
-func (p *Project) DisplayTitleWithTooltip(locale translation.Locale) string {
- var typeDispalyName string
- switch p.Type {
- case TypeIndividual:
- typeDispalyName = locale.Tr("projects.type.individual.displayname")
- case TypeRepository:
- typeDispalyName = locale.Tr("projects.type.repository.displayname")
- case TypeOrganization:
- typeDispalyName = locale.Tr("projects.type.organization.displayname")
- default:
- typeDispalyName = fmt.Sprintf("Unknown project type id: %d", p.Type)
- }
- return fmt.Sprintf(`%s`, typeDispalyName, html.EscapeString(p.Title))
-}
-
func init() {
db.RegisterModel(new(Project))
}
diff --git a/options/locale/locale_en-US.ini b/options/locale/locale_en-US.ini
index b0d91232e5c58..c0e94d3b87903 100644
--- a/options/locale/locale_en-US.ini
+++ b/options/locale/locale_en-US.ini
@@ -1328,11 +1328,11 @@ issues.remove_label = removed the %s label %s
issues.remove_labels = removed the %s labels %s
issues.add_remove_labels = added %s and removed %s labels %s
issues.add_milestone_at = `added this to the %s milestone %s`
-issues.add_project_at = `added this to the %s project %s`
+issues.add_project_at = `added this to the %s project %s`
issues.change_milestone_at = `modified the milestone from %s to %s %s`
-issues.change_project_at = `modified the project from %s to %s %s`
+issues.change_project_at = `modified the project from %s to %s %s`
issues.remove_milestone_at = `removed this from the %s milestone %s`
-issues.remove_project_at = `removed this from the %s project %s`
+issues.remove_project_at = `removed this from the %s project %s`
issues.deleted_milestone = `(deleted)`
issues.deleted_project = `(deleted)`
issues.self_assign_at = `self-assigned this %s`
@@ -3416,6 +3416,6 @@ runs.no_matching_runner_helper = No matching runner: %s
need_approval_desc = Need approval to run workflows for fork pull request.
[projects]
-type.individual.displayname = Individual Project
-type.repository.displayname = Repository Project
-type.organization.displayname = Organization Project
\ No newline at end of file
+type-1.display_name = Individual Project
+type-2.display_name = Repository Project
+type-3.display_name = Organization Project
diff --git a/templates/repo/issue/view_content/comments.tmpl b/templates/repo/issue/view_content/comments.tmpl
index 9e094551b931e..45077e91ba12e 100644
--- a/templates/repo/issue/view_content/comments.tmpl
+++ b/templates/repo/issue/view_content/comments.tmpl
@@ -732,14 +732,22 @@
{{template "shared/user/avatarlink" dict "Context" $.Context "user" .Poster}}
{{template "shared/user/authorlink" .Poster}}
- {{if gt .OldProjectID 0}}
- {{if gt .ProjectID 0}}
- {{$.locale.Tr "repo.issues.change_project_at" (.OldProject.DisplayTitleWithTooltip $.locale) (.Project.DisplayTitleWithTooltip $.locale) $createdStr | Safe}}
- {{else}}
- {{$.locale.Tr "repo.issues.remove_project_at" (.OldProject.DisplayTitleWithTooltip $.locale) $createdStr | Safe}}
- {{end}}
+ {{$oldProjectDisplayHtml := "Unknown Project"}}
+ {{if .OldProject}}
+ {{$trKey := printf "projects.type-%d.display_name" .OldProject.Type}}
+ {{$oldProjectDisplayHtml = printf `%s` ($.locale.Tr $trKey | Escape) (.OldProject.Title | Escape)}}
+ {{end}}
+ {{$newProjectDisplayHtml := "Unknown Project"}}
+ {{if .Project}}
+ {{$trKey := printf "projects.type-%d.display_name" .Project.Type}}
+ {{$newProjectDisplayHtml = printf `%s` ($.locale.Tr $trKey | Escape) (.Project.Title | Escape)}}
+ {{end}}
+ {{if and (gt .OldProjectID 0) (gt .ProjectID 0)}}
+ {{$.locale.Tr "repo.issues.change_project_at" $oldProjectDisplayHtml $newProjectDisplayHtml $createdStr | Safe}}
+ {{else if gt .OldProjectID 0}}
+ {{$.locale.Tr "repo.issues.remove_project_at" $oldProjectDisplayHtml $createdStr | Safe}}
{{else if gt .ProjectID 0}}
- {{$.locale.Tr "repo.issues.add_project_at" (.Project.DisplayTitleWithTooltip $.locale) $createdStr | Safe}}
+ {{$.locale.Tr "repo.issues.add_project_at" $newProjectDisplayHtml $createdStr | Safe}}
{{end}}