Forum: Ruby on Rails some bugs(?) using the globalize plugin

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.
jeroen (Guest)
on 2005-12-06 14:35
(Received via mailing list)
Hi,

I went ahead an installed the Globalize plugin. Things seems to be
working alright for Spanish and Dutch.

Selecting french it appears the encoding doesn't work properly. I don't
know how this will show up in your mail client but it seems to just
ouput HEX values or something: Mardi 06 DxC3xA9cembre 2005

Perhaps the data did not get loaded into my DB properly (postgresql 8,
created with encoding=UNICODE).


Also, Israel throws me an error:

<% Locale.set("he-IL") %>
<h1><%= Time.now.localize("%A %d %B %Y") %></h1>

text was supposed to be a Array, but was a String

Extracted source (around line #2):

1: <% Locale.set("he-IL") %>
2: <h1><%= Time.now.localize("%A %d %B %Y") %></h1>
3:
4: <div id="ladder_container">
5: <%= render(:partial => "shared/loading", :locals => { :prefix =>
'ldr' }) %>

RAILS_ROOT: script/../config/..
Application Trace | Framework Trace | Full Trace

/usr/lib/ruby/gems/1.8/gems/activerecord-1.13.0/lib/active_record/base.rb:1560:in
`unserialize_attribute'
/usr/lib/ruby/gems/1.8/gems/activerecord-1.13.0/lib/active_record/base.rb:1508:in
`read_attribute'
/usr/lib/ruby/gems/1.8/gems/activerecord-1.13.0/lib/active_record/base.rb:1479:in
`method_missing'
./script/../config/../vendor/plugins/globalize/lib/globalize/localization/db_view_translator.rb:79:in
`fetch_view_translation'
./script/../config/../vendor/plugins/globalize/lib/globalize/localization/db_view_translator.rb:22:in
`fetch'
./script/../config/../vendor/plugins/globalize/lib/globalize/localization/locale.rb:136:in
`translate'
./script/../config/../vendor/plugins/globalize/lib/globalize/localization/core_ext.rb:17:in
`t'
./script/../config/../vendor/plugins/globalize/lib/globalize/localization/core_ext.rb:112:in
`localize'
./script/../config/../vendor/plugins/globalize/lib/globalize/localization/core_ext.rb:107:in
`scan'
./script/../config/../vendor/plugins/globalize/lib/globalize/localization/core_ext.rb:107:in
`localize'
#{RAILS_ROOT}/app/views/home/index.rhtml:2


CHeers,

Jeroen
jeroen (Guest)
on 2005-12-06 14:52
(Received via mailing list)
Jeroen H. wrote:
> Hi,
>
> I went ahead an installed the Globalize plugin. Things seems to be
> working alright for Spanish and Dutch.
>
> Selecting french it appears the encoding doesn't work properly. I don't
> know how this will show up in your mail client but it seems to just
> ouput HEX values or something: Mardi 06 DxC3xA9cembre 2005

Hmm, it seems to store characters like this in the migraion.rb file. I
wonder why it doesn't just use the actualy characters in an UNICODE/utf8
file. I'm no i18n export so I'm sure there is a reason for this.

Cheers,

Jeroen
Josh Harvey (Guest)
on 2005-12-06 16:00
Yep, there does seem to be something wrong with the encoding of the
supplied translation strings. I encoded the translations in YAML,
because the translations are arrays. They have to be arrays in order to
support pluralization.

I'm looking into this now, and I'll let you know what I find.

Best,
Josh

jeroen wrote:
> Jeroen H. wrote:
>> Hi,
>>
>> I went ahead an installed the Globalize plugin. Things seems to be
>> working alright for Spanish and Dutch.
>>
>> Selecting french it appears the encoding doesn't work properly. I don't
>> know how this will show up in your mail client but it seems to just
>> ouput HEX values or something: Mardi 06 DxC3xA9cembre 2005
>
> Hmm, it seems to store characters like this in the migraion.rb file. I
> wonder why it doesn't just use the actualy characters in an UNICODE/utf8
> file. I'm no i18n export so I'm sure there is a reason for this.
>
> Cheers,
>
> Jeroen
jeroen (Guest)
on 2005-12-06 17:56
(Received via mailing list)
Hi Josh,

Josh Harvey wrote:
> Yep, there does seem to be something wrong with the encoding of the
> supplied translation strings. I encoded the translations in YAML,
> because the translations are arrays.

Sorry, I don't quite inderstand what you mean here..

> They have to be arrays in order to
> support pluralization.
>
> I'm looking into this now, and I'll let you know what I find.

Okay. I also read a message by somebody saying YAML might not be the
right format for this. I know Rails is not keen on XML, but for this
kinds of stuff it might actually be a good candidate.

Jeroen
Joshua H. (Guest)
on 2005-12-06 20:14
I agree in this case. I found the problem, and it's YAML related
(although not YAML's fault). I changed Globalize to use straight text
strings instead of YAML. I'm converting the data to the new format now,
so it should be ready soon.

Thanks for the bug report :)

Josh

jeroen wrote:
>> I'm looking into this now, and I'll let you know what I find.
>
> Okay. I also read a message by somebody saying YAML might not be the
> right format for this. I know Rails is not keen on XML, but for this
> kinds of stuff it might actually be a good candidate.
>
> Jeroen
This topic is locked and can not be replied to.