Skip to content

armgit / spree

Public Imported from GitHub
0

Open Source Platform for DTC, B2B Commerce, Marketplaces & Omnichannel. REST APIs, TypeScript SDKs, and production-ready Next.js storefront. Self-host it. Own your data. No vendor lock-in. Zero platform fees.

Fixed I18n for Ruby 3.0

Damian Legawieca25260f739bb
diff --git a/core/lib/spree/i18n.rb b/core/lib/spree/i18n.rb
index 8d1523a790..9967829fd6 100644
--- a/core/lib/spree/i18n.rb
+++ b/core/lib/spree/i18n.rb
@@ -1,20 +1,19 @@
require 'i18n'
require 'active_support/core_ext/array/extract_options'
-require 'spree/i18n/base'
require 'action_view'
module Spree
- extend ::ActionView::Helpers::TranslationHelper
- extend ::ActionView::Helpers::TagHelper
+ class TranslationHelperWrapper
+ include ActionView::Helpers::TranslationHelper
+ end
class << self
# Add spree namespace and delegate to Rails TranslationHelper for some nice
# extra functionality. e.g return reasonable strings for missing translations
- def translate(*args)
- options = args.extract_options!
+ def translate(key, options = {})
options[:scope] = [*options[:scope]].unshift(:spree).uniq
- args << options
- super(*args)
+
+ TranslationHelperWrapper.new.translate(key, **options)
end
alias t translate