Some bugs(?) using the globalize plugin


#1

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

<%= Time.now.localize("%A %d %B %Y") %>

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

Extracted source (around line #2):

1: <% Locale.set(“he-IL”) %>
2:

<%= Time.now.localize("%A %d %B %Y") %>


3:
4:

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:inread_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:infetch_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:intranslate’
./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:inlocalize’
./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:inlocalize’
#{RAILS_ROOT}/app/views/home/index.rhtml:2

CHeers,

Jeroen


#2

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


#3

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


#4

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

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


#5

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