I'm trying to implement internationalization in my app. I followed the instructions on the Globalize example (http://wiki.globalize- rails.org/globalize/show/Example+Application), using in_place_editor. The translation works fine, however, I can't get in_place_editor to work to translate the strings.
My controller:
class Admin::TranslateController < ApplicationController in_place_edit_for :translation, :text
def index @view_translations = ViewTranslation.find(:all, :conditions => [ 'built_in IS NULL AND language_id = ?', Locale.language.id ], :order => 'text') end
def translation_text @translation = ViewTranslation.find(params[:id]) render :text => @translation.text || "" end
def set_translation_text @translation = ViewTranslation.find(params[:id]) previous = @translation.text @translation.text = params[:value] @translation.text = previous unless @translation.save render :partial => "translation_text", :object => @translation.text end end
And the call in view:
<%= in_place_editor "tr_#{tr.id}", :url => { :action => :set_translation_text, :id => tr.id }, :load_text_url => url_for({ :action => :translation_text, :id => tr.id })%> </p>
It loads the value that it gets from translation_text, but when I try to change the string, all it says in the box is 'Saving...' and it never updates the entry.