GetText and rjs templates?


#1

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 :

<%= javascript_include_tag :defaults %>
Some text to change
<%= link_to_remote 'click', :url => {:action => 'dosomething'} %>

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??


#2

On 1/28/06, Trung T. removed_email_address@domain.invalid wrote:

<%= javascript_include_tag :defaults %>

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 F.
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!)


#3

Hi,

On Sun, 29 Jan 2006 03:39:16 +0100
Trung T. removed_email_address@domain.invalid wrote:

<%= javascript_include_tag :defaults %>

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
:
: