In_place_editor not working for Internationalization

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 })%>

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.

On 21 Dec 2007, at 01:47, Franz wrote:

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.

If your app is a rails 2.0 app, in_place_editor currently doesn’t work
with crsf.

Fred

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs