Skip to content

Commit

Permalink
Add translation options
Browse files Browse the repository at this point in the history
  • Loading branch information
tomdonarski committed Oct 6, 2023
1 parent 1ecdaeb commit 649cc05
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
5 changes: 4 additions & 1 deletion app/models/spree/admin/actions/action_builder.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ def initialize(config)
@availability_check = nil
@method = config[:method]
@id = config[:id]
@translation_options = config[:translation_options]
end

def build
Expand All @@ -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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down

0 comments on commit 649cc05

Please sign in to comment.