hi, is it possible that gettext don''t work with rjs templates? i''ve just tried this simple example blog_controller.rb : class BlogController < ApplicationController def index end def dosomething end end index.rhtml : <html> <head> <%= javascript_include_tag :defaults %> </head> <body> <div id="test">Some text to change </div> <%= link_to_remote ''click'', :url => {:action => ''dosomething''} %> </body> </html> and the rjs template dosomething.rjs : page.replace_html ''test'', ''ruby on rails'' this works fine until i add init_gettext "blog" to my application.rb no errors from the server, the div just don''t update its contents anymore. what''s wrong?? -- Posted via http://www.ruby-forum.com/.
On 1/28/06, Trung Tran <trung_tran@gmx.de> wrote:> hi, > > is it possible that gettext don''t work with rjs templates? > > i''ve just tried this simple example > > blog_controller.rb : > > class BlogController < ApplicationController > def index > > end > def dosomething > > end > end > > index.rhtml : > > <html> > <head> > <%= javascript_include_tag :defaults %> > </head> > <body> > <div id="test">Some text to change </div> > <%= link_to_remote ''click'', :url => {:action => ''dosomething''} %> > </body> > </html> > > and the rjs template > dosomething.rjs : > page.replace_html ''test'', ''ruby on rails'' > > this works fine until i add > > init_gettext "blog" > > to my application.rb > no errors from the server, the div just don''t update its contents > anymore. > > what''s wrong?? >We saw something similar at work but haven''t gotten to the bottom of it yet. It _looks_ like there is a problem with the to_json code, but I can''t say for sure. -- Chad Fowler http://chadfowler.com http://www.pragmaticprogrammer.com/titles/fr_rr/ (Rails Recipes coming SOON) http://pragmaticprogrammer.com/titles/mjwti/ (My Job Went to India, and All I Got Was This Lousy Book) http://rubycentral.org http://rubygarden.org http://rubygems.rubyforge.org (over one million gems served!)
Hi, On Sun, 29 Jan 2006 03:39:16 +0100 Trung Tran <trung_tran@gmx.de> wrote:> hi, > > is it possible that gettext don''t work with rjs templates? > > i''ve just tried this simple example > > blog_controller.rb : > > class BlogController < ApplicationController > def index > > end > def dosomething > > end > end > > index.rhtml : > > <html> > <head> > <%= javascript_include_tag :defaults %> > </head> > <body> > <div id="test">Some text to change </div> > <%= link_to_remote ''click'', :url => {:action => ''dosomething''} %> > </body> > </html> > > and the rjs template > dosomething.rjs : > page.replace_html ''test'', ''ruby on rails'' > > this works fine until i add > > init_gettext "blog" > > to my application.rb > no errors from the server, the div just don''t update its contents > anymore. > > what''s wrong??Oops, it''s a bug(?) of Ruby-GetText. Remove the line 68 of gettext/rails.rb, please. #(e.g.) /usr/lib/ruby/gems/1.8/gems/gettext-1.1.1/lib/gettext/rails.rb : : def init_gettext_main bindtextdomain(@@gettext_domainname, request.cgi) #You need to pass CGI object first. # Remove a line below # @headers["Content-Type"] = "#{@@gettext_content_type}; charset=#{GetText.output_charset}" end : : -- .:% Masao Mutoh<mutoh@highway.ne.jp>