Skip to content
This repository was archived by the owner on Nov 30, 2018. It is now read-only.

Commit d9d7cd4

Browse files
committed
Switch to locale before block rendering
1 parent ee70898 commit d9d7cd4

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

lib/active_admin/globalize/attributes_table_extension.rb

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,8 +88,10 @@ def field_translations(field, tag, initial_locale)
8888
css_classes = ['field-translation', "locale-#{translation.locale}"]
8989
# Initially only element for selected locale is visible
9090
css_classes.push 'hidden' unless translation.locale == initial_locale.to_sym
91-
# Build content for cell or div
92-
content = block_given? ? yield(translation) : translation.send(field)
91+
# Build content for cell or div using translation locale and given block
92+
content = I18n.with_locale(translation.locale) do
93+
block_given? ? yield(translation) : translation.send(field)
94+
end
9395
# return element
9496
if tag == :span # inline element
9597
# attach class to span if inline

0 commit comments

Comments
 (0)