Skip to content
Permalink
Browse files

bugfix: when editing a translation, what was being translated was sho…

…wing up with existing translation under the original area.
  • Loading branch information...
Walter McGinnis
Walter McGinnis committed Jan 25, 2011
1 parent 767d8d9 commit 11d56a308abe54ecb7c3b87d023977ac0e03826f
@@ -107,6 +107,20 @@ def get_translation
define_method("get_" + term) do
value = @translatable_class.find(params[@translatable_key])

# handle case of editing translation from another locale than original
if value.locale != value.original_locale &&
params[:controller] == 'translations' &&
params[:action] == 'edit'

starting_locale = I18n.locale

I18n.locale = value.original_locale

value.reload

I18n.locale = starting_locale
end

instance_variable_set("@" + term, value)
end
end
@@ -57,6 +57,11 @@ class TranslationTest < ActionController::IntegrationTest
assert_contain "標籤"
end

should "have original in original locale when viewing edit translation from a different locale" do
visit "/fr/items/1/translations/fr/edit"
assert_contain @item.label
end

should "be able to edit translation" do
visit "/en/items/1/translations/fr/edit"
fill_in "item_translation_label", :with => "#{LOCALE_LABELS[:fr]} 2"

0 comments on commit 11d56a3

Please sign in to comment.
You can’t perform that action at this time.