Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature translate locales with region #1391

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions app/models/concerns/spina/translated_content.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,14 @@ module TranslatedContent
included do
# Store each locale's content in [locale]_content as an array of parts
Spina.locales.each do |locale|
attr_json "#{locale}_content".to_sym, AttrJson::Type::SpinaPartsModel.new, array: true, default: -> { [] }
attr_json_setter_monkeypatch "#{locale}_content".to_sym
attr_json_accepts_nested_attributes_for "#{locale}_content".to_sym
attr_json "#{locale.to_s.underscore}_content".to_sym, AttrJson::Type::SpinaPartsModel.new, array: true, default: -> { [] }
attr_json_setter_monkeypatch "#{locale.to_s.underscore}_content".to_sym
attr_json_accepts_nested_attributes_for "#{locale.to_s.underscore}_content".to_sym
end
end

def find_part(name)
send("#{I18n.locale}_content").find { |part| part.name.to_s == name.to_s }
send("#{I18n.locale.to_s.underscore}_content").find { |part| part.name.to_s == name.to_s }
end
end
end
Loading
Loading