Skip to content

Commit d3c9815

Browse files
committed
feature: Allow locales with region
example pt-PT
1 parent d5b7770 commit d3c9815

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

app/models/concerns/spina/translated_content.rb

+4-4
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,14 @@ module TranslatedContent
77
included do
88
# Store each locale's content in [locale]_content as an array of parts
99
Spina.locales.each do |locale|
10-
attr_json "#{locale}_content".to_sym, AttrJson::Type::SpinaPartsModel.new, array: true, default: -> { [] }
11-
attr_json_setter_monkeypatch "#{locale}_content".to_sym
12-
attr_json_accepts_nested_attributes_for "#{locale}_content".to_sym
10+
attr_json "#{locale.to_s.underscore}_content".to_sym, AttrJson::Type::SpinaPartsModel.new, array: true, default: -> { [] }
11+
attr_json_setter_monkeypatch "#{locale.to_s.underscore}_content".to_sym
12+
attr_json_accepts_nested_attributes_for "#{locale.to_s.underscore}_content".to_sym
1313
end
1414
end
1515

1616
def find_part(name)
17-
send("#{I18n.locale}_content").find { |part| part.name.to_s == name.to_s }
17+
send("#{I18n.locale.to_s.underscore}_content").find { |part| part.name.to_s == name.to_s }
1818
end
1919
end
2020
end

0 commit comments

Comments
 (0)