Skip to content

Commit 64f6a58

Browse files
authored
Merge pull request #5590 from solidusio/elia/vc-3.9
[admin] Require ViewComponent v3.9 with inheritable translations
2 parents 7bab27b + 23e87cc commit 64f6a58

File tree

2 files changed

+1
-26
lines changed

2 files changed

+1
-26
lines changed

admin/app/components/solidus_admin/base_component.rb

Lines changed: 0 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -13,31 +13,6 @@ def icon_tag(name, **attrs)
1313
render component("ui/icon").new(name: name, **attrs)
1414
end
1515

16-
module InheritableTranslations
17-
def build_i18n_backend
18-
return if compiled?
19-
20-
# We need to load the translations files from the ancestors so a component
21-
# can inherit translations from its parent and is able to overwrite them.
22-
translation_files = ancestors.reverse_each.with_object([]) do |ancestor, files|
23-
if ancestor.is_a?(Class) && ancestor < ViewComponent::Base
24-
files.concat(ancestor.sidecar_files(%w[yml yaml].freeze))
25-
end
26-
end
27-
28-
# In development it will become nil if the translations file is removed
29-
self.i18n_backend = if translation_files.any?
30-
ViewComponent::Translatable::I18nBackend.new(
31-
i18n_scope: i18n_scope,
32-
load_paths: translation_files
33-
)
34-
end
35-
end
36-
end
37-
38-
# Can be removed once https://github.com/ViewComponent/view_component/pull/1934 is released
39-
extend InheritableTranslations unless Gem::Version.new(ViewComponent::VERSION::STRING) >= Gem::Version.new("3.9")
40-
4116
def missing_translation(key, options)
4217
keys = I18n.normalize_keys(options[:locale] || I18n.locale, key, options[:scope])
4318

admin/solidus_admin.gemspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,5 +30,5 @@ Gem::Specification.new do |s|
3030
s.add_dependency 'solidus_core', '> 4.2'
3131
s.add_dependency 'stimulus-rails', '~> 1.2'
3232
s.add_dependency 'turbo-rails', '~> 1.4'
33-
s.add_dependency 'view_component', '~> 3.3'
33+
s.add_dependency 'view_component', '~> 3.9'
3434
end

0 commit comments

Comments
 (0)