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

Add i18n for project activity details

Christophe Bliardadf003e99d6c
diff --git a/config/locales/en.yml b/config/locales/en.yml
index 29d20aa2949..383b117765c 100644
--- a/config/locales/en.yml
+++ b/config/locales/en.yml
@@ -537,14 +537,24 @@ en:
member:
roles: "Roles"
project:
+ active_value:
+ true: "unarchived"
+ false: "archived"
identifier: "Identifier"
latest_activity_at: "Latest activity at"
parent: "Subproject of"
+ public_value:
+ title: "Visibility"
+ true: "public"
+ false: "private"
queries: "Queries"
+ templated: "Template project"
+ templated_value:
+ true: "marked as template"
+ false: "unmarked as template"
types: "Types"
versions: "Versions"
work_packages: "Work Packages"
- templated: 'Template project'
projects/status:
code: 'Status'
explanation: 'Status description'
diff --git a/lib/open_project/journal_formatter/active_status.rb b/lib/open_project/journal_formatter/active_status.rb
index cb171805bd3..479020a8b28 100644
--- a/lib/open_project/journal_formatter/active_status.rb
+++ b/lib/open_project/journal_formatter/active_status.rb
@@ -28,9 +28,16 @@
class OpenProject::JournalFormatter::ActiveStatus < JournalFormatter::Base
def render(_key, values, options = { html: true })
- label_text = options[:html] ? content_tag('strong', "Project") : "Project"
- activated_text = values.last ? "unarchived" : "archived"
+ label_text = label('project')
+ label_text = content_tag('strong', label_text) if options[:html]
- I18n.t(:text_journal_label_value, label: label_text, value: activated_text)
+ value = \
+ if values.last
+ I18n.t('activerecord.attributes.project.active_value.true')
+ else
+ I18n.t('activerecord.attributes.project.active_value.false')
+ end
+
+ I18n.t(:text_journal_label_value, label: label_text, value:)
end
end
diff --git a/lib/open_project/journal_formatter/template.rb b/lib/open_project/journal_formatter/template.rb
index 7484a95b836..f5cc51fa95d 100644
--- a/lib/open_project/journal_formatter/template.rb
+++ b/lib/open_project/journal_formatter/template.rb
@@ -28,9 +28,16 @@
class OpenProject::JournalFormatter::Template < JournalFormatter::Base
def render(_key, values, options = { html: true })
- label_text = options[:html] ? content_tag('strong', "Project") : "Project"
- activated_text = values.last ? "marked as template" : "unmarked as template"
+ label_text = label('project')
+ label_text = content_tag('strong', label_text) if options[:html]
- I18n.t(:text_journal_label_value, label: label_text, value: activated_text)
+ value = \
+ if values.last
+ I18n.t('activerecord.attributes.project.templated_value.true')
+ else
+ I18n.t('activerecord.attributes.project.templated_value.false')
+ end
+
+ I18n.t(:text_journal_label_value, label: label_text, value:)
end
end
diff --git a/lib/open_project/journal_formatter/visibility.rb b/lib/open_project/journal_formatter/visibility.rb
index bc6289c5e19..44f7a403f96 100644
--- a/lib/open_project/journal_formatter/visibility.rb
+++ b/lib/open_project/journal_formatter/visibility.rb
@@ -28,9 +28,16 @@
class OpenProject::JournalFormatter::Visibility < JournalFormatter::Base
def render(_key, values, options = { html: true })
- label_text = options[:html] ? content_tag('strong', "Visibility") : "Visibility"
- activated_text = "set to #{values.last ? 'public' : 'private'}"
+ label_text = I18n.t('activerecord.attributes.project.public_value.title')
+ label_text = content_tag('strong', label_text) if options[:html]
- I18n.t(:text_journal_label_value, label: label_text, value: activated_text)
+ value = \
+ if values.last
+ I18n.t('activerecord.attributes.project.public_value.true')
+ else
+ I18n.t('activerecord.attributes.project.public_value.false')
+ end
+
+ I18n.t(:text_journal_set_to, label: label_text, value:)
end
end
diff --git a/spec/factories/journal_factory.rb b/spec/factories/journal_factory.rb
index ce3d6889b98..e568e615147 100644
--- a/spec/factories/journal_factory.rb
+++ b/spec/factories/journal_factory.rb
@@ -57,7 +57,7 @@ FactoryBot.define do
end
factory :project_journal, class: 'Journal' do
- journable_type { 'Project' }
+ journable factory: :project
data { build(:journal_project_journal) }
end
end
diff --git a/spec/lib/journal_formatter/active_status_spec.rb b/spec/lib/journal_formatter/active_status_spec.rb
index 79dc8023ead..1c6bb1232db 100644
--- a/spec/lib/journal_formatter/active_status_spec.rb
+++ b/spec/lib/journal_formatter/active_status_spec.rb
@@ -29,7 +29,7 @@
require 'spec_helper'
describe OpenProject::JournalFormatter::ActiveStatus do
- let(:instance) { described_class.new(build(:journal)) }
+ let(:instance) { described_class.new(build(:project_journal)) }
it "renders correctly when unarchiving" do
html = instance.render("active", [false, true], html: true)
diff --git a/spec/lib/journal_formatter/template_spec.rb b/spec/lib/journal_formatter/template_spec.rb
index b6008cfc115..bacf44fc67c 100644
--- a/spec/lib/journal_formatter/template_spec.rb
+++ b/spec/lib/journal_formatter/template_spec.rb
@@ -29,7 +29,7 @@
require 'spec_helper'
describe OpenProject::JournalFormatter::Template do
- let(:instance) { described_class.new(build(:journal, journable: build(:project))) }
+ let(:instance) { described_class.new(build(:project_journal)) }
it "renders correctly when marked as template" do
html = instance.render("templated", [false, true], html: true)
diff --git a/spec/lib/journal_formatter/visibility_spec.rb b/spec/lib/journal_formatter/visibility_spec.rb
index a30fe0e370a..fa2a0b67878 100644
--- a/spec/lib/journal_formatter/visibility_spec.rb
+++ b/spec/lib/journal_formatter/visibility_spec.rb
@@ -29,7 +29,7 @@
require File.expand_path("#{File.dirname(__FILE__)}/../../spec_helper.rb")
describe OpenProject::JournalFormatter::Visibility do
- let(:instance) { described_class.new(build(:journal)) }
+ let(:instance) { described_class.new(build(:project_journal)) }
it "renders correctly when setting visibility" do
html = instance.render("public", [nil, true], html: true)