Skip to content

OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub

Use translation to count projects on admin project custom field row

Dombi Attila2fb9791d85f8
diff --git a/app/components/settings/project_custom_field_sections/custom_field_row_component.html.erb b/app/components/settings/project_custom_field_sections/custom_field_row_component.html.erb
index 30cac90ed3e..bba637366eb 100644
--- a/app/components/settings/project_custom_field_sections/custom_field_row_component.html.erb
+++ b/app/components/settings/project_custom_field_sections/custom_field_row_component.html.erb
@@ -23,7 +23,8 @@
end
content_container.with_column(mr: 2) do
render(Primer::Beta::Text.new(font_size: :small)) do
- project_count_text
+ t("project.count",
+ count: @project_custom_field.project_custom_field_project_mappings.size)
end
end
if @project_custom_field.required?
diff --git a/app/components/settings/project_custom_field_sections/custom_field_row_component.rb b/app/components/settings/project_custom_field_sections/custom_field_row_component.rb
index 1b203dabce3..765ec50dc0d 100644
--- a/app/components/settings/project_custom_field_sections/custom_field_row_component.rb
+++ b/app/components/settings/project_custom_field_sections/custom_field_row_component.rb
@@ -86,16 +86,6 @@ module Settings
end
end
- def project_count_text
- project_count = @project_custom_field.project_custom_field_project_mappings.size
-
- if project_count == 1
- "#{project_count} #{t('activerecord.models.project')}"
- else
- "#{project_count} #{t('label_project_plural')}"
- end
- end
-
def first?
@first ||=
if @first_and_last.first
diff --git a/config/locales/en.yml b/config/locales/en.yml
index 035ce802132..d0a8ec18b76 100644
--- a/config/locales/en.yml
+++ b/config/locales/en.yml
@@ -2745,6 +2745,10 @@ Project attributes and sections are defined in the <a href=%{admin_settings_url}
archive:
are_you_sure: "Are you sure you want to archive the project '%{name}'?"
archived: "Archived"
+ count:
+ zero: "0 Projects"
+ one: "1 Project"
+ other: "%{count} Projects"
project_module_activity: "Activity"
project_module_forums: "Forums"