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

i18n of relation labels and tab section

Aaron Contreras50880359719c
diff --git a/app/components/work_package_relations_tab/edit_work_package_relation_form_component.html.erb b/app/components/work_package_relations_tab/edit_work_package_relation_form_component.html.erb
new file mode 100644
index 00000000000..3d77adf5ae8
--- /dev/null
+++ b/app/components/work_package_relations_tab/edit_work_package_relation_form_component.html.erb
@@ -0,0 +1,42 @@
+<%=
+ component_wrapper do
+ primer_form_with(
+ id: FORM_ID,
+ model: @relation,
+ method: :patch,
+ url: work_package_relation_path(@relation),
+ ) do |f|
+ flex_layout(my: 3) do |flex|
+ flex.with_row do
+ if @base_errors&.any?
+ render(Primer::Alpha::Banner.new(mb: 3, icon: :stop, scheme: :danger)) { @base_errors.join("\n") }
+ end
+ end
+ flex.with_row do
+ render_inline_form(f) do |my_form|
+ my_form.work_package_autocompleter(
+ name: :to_id,
+ label: WorkPackage.model_name.human,
+ visually_hide_label: false,
+ autocomplete_options: {
+ resource: 'work_packages',
+ searchKey: 'subjectOrId',
+ openDirectly: false,
+ focusDirectly: false,
+ dropdownPosition: 'bottom',
+ append_to: "##{WorkPackageRelationsTab::EditWorkPackageRelationDialogComponent::DIALOG_ID}"
+ }
+ )
+ end
+ end
+ flex.with_row(mt: 3) do
+ flex_layout(justify_content: :flex_end) do |actions_row|
+ actions_row.with_column do
+ render(Primer::Beta::Button.new(scheme: :primary, type: :submit)) { t(:button_save) }
+ end
+ end
+ end
+ end
+ end
+ end
+%>
diff --git a/app/components/work_package_relations_tab/edit_work_package_relation_form_component.rb b/app/components/work_package_relations_tab/edit_work_package_relation_form_component.rb
new file mode 100644
index 00000000000..af43d36314e
--- /dev/null
+++ b/app/components/work_package_relations_tab/edit_work_package_relation_form_component.rb
@@ -0,0 +1,44 @@
+# frozen_string_literal: true
+
+#-- copyright
+# OpenProject is an open source project management software.
+# Copyright (C) the OpenProject GmbH
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License version 3.
+#
+# OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows:
+# Copyright (C) 2006-2013 Jean-Philippe Lang
+# Copyright (C) 2010-2013 the ChiliProject Team
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+#
+# See COPYRIGHT and LICENSE files for more details.
+#++
+
+class WorkPackageRelationsTab::EditWorkPackageRelationFormComponent < ApplicationComponent
+ include ApplicationHelper
+ include OpTurbo::Streamable
+ include OpPrimer::ComponentHelpers
+
+ FORM_ID = "edit-work-package-relation-form"
+
+ def initialize(relation:, base_errors: nil)
+ super()
+
+ @relation = relation
+ @base_errors = base_errors
+ end
+end
diff --git a/app/components/work_package_relations_tab/index_component.html.erb b/app/components/work_package_relations_tab/index_component.html.erb
index dbc070bab64..4a6762e0403 100644
--- a/app/components/work_package_relations_tab/index_component.html.erb
+++ b/app/components/work_package_relations_tab/index_component.html.erb
@@ -3,16 +3,15 @@
flex_layout(justify_content: :space_between, align_items: :center, mb: 4) do |action_bar|
action_bar.with_column do
render(Primer::Beta::Text.new(color: :muted)) do
- "Add relations to other work packages to create a link between them."
+ t("work_package_relations_tab.index.action_bar_title")
end
end
action_bar.with_column do
render(Primer::Alpha::ActionMenu.new(menu_id: "relations-list-action-menu")) do |menu|
menu.with_show_button do |button|
button.with_leading_visual_icon(icon: :"plus")
-
button.with_trailing_action_icon(icon: :"triangle-down")
- "Relation"
+ t(:label_relation)
end
Relation::TYPES.values.each do |type_configuration_hash|
menu.with_item(label: t(type_configuration_hash[:name]).capitalize) do |item|
@@ -27,13 +26,17 @@
if relations.any?
flex_layout(classes: "work-package-relations-tab--list-container") do |flex|
relations.group_by(&:relation_type).each do |relation_type, relations_of_type|
+ relation_relative_to_work_package = relation_type
+ key_namespace = "work_package_relations_tab.relations"
+ base_key = "#{key_namespace}.label_#{relation_type}"
+
flex.with_row do
render(border_box_container(padding: :condensed)) do |border_box|
border_box.with_header(py: 3) do
flex_layout(align_items: :center) do |flex|
flex.with_column(mr: 2) do
render(Primer::Beta::Text.new(font_size: :normal, font_weight: :bold)) do
- t(relations_of_type.first.label_for(work_package)).capitalize
+ t("#{base_key}_plural").capitalize
end
end
flex.with_column do
@@ -55,8 +58,8 @@
else
render Primer::Beta::Blankslate.new(border: true) do |component|
component.with_visual_icon(icon: "package-dependents")
- component.with_heading(tag: :h2).with_content("No relations")
- component.with_description { "This work package does not yet have any relations." }
+ component.with_heading(tag: :h2).with_content(t("work_package_relations_tab.index.blankslate_heading"))
+ component.with_description { t("work_package_relations_tab.index.blankslate_description") }
end
end
%>
diff --git a/app/models/relation.rb b/app/models/relation.rb
index f57f195fb1f..ed47264e7d8 100644
--- a/app/models/relation.rb
+++ b/app/models/relation.rb
@@ -51,12 +51,13 @@ class Relation < ApplicationRecord
TYPE_RELATES => {
name: :label_relates_to, sym_name: :label_relates_to, order: 1, sym: TYPE_RELATES
},
- TYPE_DUPLICATES => {
- name: :label_duplicates, sym_name: :label_duplicated_by, order: 2, sym: TYPE_DUPLICATED
+ TYPE_PRECEDES => {
+ name: :label_precedes, sym_name: :label_follows, order: 6,
+ sym: TYPE_FOLLOWS, reverse: TYPE_FOLLOWS
},
- TYPE_DUPLICATED => {
- name: :label_duplicated_by, sym_name: :label_duplicates, order: 3,
- sym: TYPE_DUPLICATES, reverse: TYPE_DUPLICATES
+ TYPE_FOLLOWS => {
+ name: :label_follows, sym_name: :label_precedes, order: 7,
+ sym: TYPE_PRECEDES
},
TYPE_BLOCKS => {
name: :label_blocks, sym_name: :label_blocked_by, order: 4, sym: TYPE_BLOCKED
@@ -65,13 +66,12 @@ class Relation < ApplicationRecord
name: :label_blocked_by, sym_name: :label_blocks, order: 5,
sym: TYPE_BLOCKS, reverse: TYPE_BLOCKS
},
- TYPE_PRECEDES => {
- name: :label_precedes, sym_name: :label_follows, order: 6,
- sym: TYPE_FOLLOWS, reverse: TYPE_FOLLOWS
+ TYPE_DUPLICATES => {
+ name: :label_duplicates, sym_name: :label_duplicated_by, order: 6, sym: TYPE_DUPLICATED
},
- TYPE_FOLLOWS => {
- name: :label_follows, sym_name: :label_precedes, order: 7,
- sym: TYPE_PRECEDES
+ TYPE_DUPLICATED => {
+ name: :label_duplicated_by, sym_name: :label_duplicates, order: 7,
+ sym: TYPE_DUPLICATES, reverse: TYPE_DUPLICATES
},
TYPE_INCLUDES => {
name: :label_includes, sym_name: :label_part_of, order: 8,
diff --git a/config/locales/en.yml b/config/locales/en.yml
index 008c15973ab..1f97029fd87 100644
--- a/config/locales/en.yml
+++ b/config/locales/en.yml
@@ -705,6 +705,45 @@ en:
version:
no_results_title_text: There are currently no versions available.
+ work_package_relations_tab:
+ index:
+ action_bar_title: "Add relations to other work packages to create a link between them."
+ no_results_title_text: There are currently no relations available.
+ blankslate_heading: "No relations"
+ blankslate_description: "This work package does not yet have any relations."
+ relations:
+ label_relates_singular: "related to"
+ label_relates_plural: "related to"
+ relates_description: "Creates a visible link between the two work packages with no additional effect"
+ label_precedes_singular: "precedessor (before)"
+ label_precedes_plural: "precedessors (before)"
+ precedes_description: "The related work package necessarily needs to finish before this one can start"
+ label_follows_singular: "successor (after)"
+ label_follows_plural: "successors (after)"
+ label_child_singular: "child"
+ label_child_plural: "child"
+ label_blocks_singular: "blocks"
+ label_blocks_plural: "blocks"
+ label_blocked_singular: "blocked by"
+ label_blocked_plural: "blocked by"
+ label_duplicates_singular: "duplicates"
+ label_duplicates_plural: "duplicates"
+ duplicates_description: "This is a copy of the related work package"
+ label_duplicated_singular: "duplicated by"
+ label_duplicated_plural: "duplicated by"
+ duplicated_description: "The related work package is a copy of this."
+ label_includes_singular: "includes"
+ label_includes_plural: "includes"
+ label_partof_singular: "part of"
+ label_partof_plural: "part of"
+ label_requires_singular: "requires"
+ label_requires_plural: "requires"
+ label_required_singular: "required by"
+ label_required_plural: "required by"
+
+ label_parent_singular: "parent"
+ label_parent_plural: "parent"
+
label_invitation: Invitation
account:
delete: "Delete account"
@@ -2567,6 +2606,7 @@ en:
label_related_work_packages: "Related work packages"
label_relates: "related to"
label_relates_to: "related to"
+ label_relation: "Relation"
label_relation_delete: "Delete relation"
label_relation_new: "New relation"
label_release_notes: "Release notes"