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

Make default queries translatable

Henriette Darge306f0795726d
diff --git a/modules/gantt/app/controllers/gantt/menus_controller.rb b/modules/gantt/app/controllers/gantt/menus_controller.rb
index 8596abbce1f..01c119e5b48 100644
--- a/modules/gantt/app/controllers/gantt/menus_controller.rb
+++ b/modules/gantt/app/controllers/gantt/menus_controller.rb
@@ -60,7 +60,7 @@ module Gantt
menu_item(
params,
- Gantt::DefaultQueryGeneratorService::QUERY_MAPPINGS[query_key]
+ I18n.t("js.queries.#{query_key.to_s}"),
)
end
end
diff --git a/modules/gantt/app/services/gantt/default_query_generator_service.rb b/modules/gantt/app/services/gantt/default_query_generator_service.rb
index 4d4d751537d..9e2f67194e4 100644
--- a/modules/gantt/app/services/gantt/default_query_generator_service.rb
+++ b/modules/gantt/app/services/gantt/default_query_generator_service.rb
@@ -29,11 +29,10 @@
module ::Gantt
class DefaultQueryGeneratorService
DEFAULT_QUERY = :all_open
- QUERY_MAPPINGS = {
- DEFAULT_QUERY => I18n.t('js.queries.all_open'),
- :milestones => I18n.t('js.queries.milestones')
- }.freeze
- QUERY_OPTIONS = QUERY_MAPPINGS.keys
+ QUERY_OPTIONS = [
+ DEFAULT_QUERY,
+ :milestones
+ ].freeze
PROJECT_DEFAULT_COLUMNS = %w[id type subject status startDate dueDate duration].freeze
GLOBAL_DEFAULT_COLUMNS = %w[id project type subject status startDate dueDate duration].freeze