From 649cc053e8ad6538fb0b9f639faf243d80e602f3 Mon Sep 17 00:00:00 2001 From: Tomasz Donarski Date: Fri, 6 Oct 2023 16:09:30 +0200 Subject: [PATCH] Add translation options --- app/models/spree/admin/actions/action_builder.rb | 5 ++++- .../spree/admin/actions/order_default_actions_builder.rb | 5 ++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/app/models/spree/admin/actions/action_builder.rb b/app/models/spree/admin/actions/action_builder.rb index 1cfa2383fd..cd8e0f1eda 100644 --- a/app/models/spree/admin/actions/action_builder.rb +++ b/app/models/spree/admin/actions/action_builder.rb @@ -12,6 +12,7 @@ def initialize(config) @availability_check = nil @method = config[:method] @id = config[:id] + @translation_options = config[:translation_options] end def build @@ -34,7 +35,9 @@ def build_config end def text - ::Spree.t(@name) + return ::Spree.t(@name) unless @translation_options.present? + + ::Spree.t(@name, scope: @translation_options[:scope], default: ::Spree.t(@name)) end # def available?(current_ability, resource) diff --git a/app/models/spree/admin/actions/order_default_actions_builder.rb b/app/models/spree/admin/actions/order_default_actions_builder.rb index 9daf302111..6096bfee47 100644 --- a/app/models/spree/admin/actions/order_default_actions_builder.rb +++ b/app/models/spree/admin/actions/order_default_actions_builder.rb @@ -28,7 +28,10 @@ def resend_config name: :resend, url: ->(resource) { resend_admin_order_path(resource) }, classes: 'btn-secondary', - method: :post + method: :post, + translation_options: { + scope: 'admin.order.events' + } } end