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.
Ruby b2b-commercee-commerceecommerceecommerce-apiecommerce-frameworkecommerce-platformheadlessheadless-commerceheadless-ecommercemarketplacemulti-tenantmulti-vendormulti-vendor-ecommerceopen-sourcespree-commerce
Removing ViewContext from I18n
Damian Legawiec923a2d34d252
diff --git a/core/lib/spree/i18n.rb b/core/lib/spree/i18n.rbindex bd8e90f56d..8d1523a790 100644--- a/core/lib/spree/i18n.rb+++ b/core/lib/spree/i18n.rb@@ -11,8 +11,6 @@ module Spree# Add spree namespace and delegate to Rails TranslationHelper for some nice# extra functionality. e.g return reasonable strings for missing translationsdef translate(*args)- @virtual_path = virtual_path-options = args.extract_options!options[:scope] = [*options[:scope]].unshift(:spree).uniqargs << options@@ -20,17 +18,5 @@ module Spreeendalias t translate-- def context- Spree::ViewContext.context- end-- def virtual_path- if context- path = context.instance_variable_get('@virtual_path')-- path&.gsub(/spree/, '')- end- endendenddiff --git a/core/spec/lib/i18n_spec.rb b/core/spec/lib/i18n_spec.rbindex 59675a9fe9..192dae1eff 100644--- a/core/spec/lib/i18n_spec.rb+++ b/core/spec/lib/i18n_spec.rb@@ -22,13 +22,6 @@ describe 'i18n' doexpect(Spree.translate(:foo)).to eql('bar')end- it 'translates within the spree scope using a path' do- allow(Spree).to receive(:virtual_path).and_return('bar')-- expect(Spree.normal_t('.legacy_translation')).to eql('back in the day...')- expect(Spree.translate('.legacy_translation')).to eql('back in the day...')- end-it 'raise error without any context when using a path' doexpect doSpree.normal_t('.legacy_translation')