Forum: Ruby on Rails GetText and rjs templates?

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Trung T. (Guest)
on 2006-01-29 04:39
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??
Chad F. (Guest)
on 2006-01-29 05:20
(Received via mailing list)
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!)
Masao M. (Guest)
on 2006-01-30 18:43
(Received via mailing list)
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
    :
    :
This topic is locked and can not be replied to.