# Some bugs(?) using the globalize plugin

**URL:** <https://www.ruby-forum.com/t/some-bugs-using-the-globalize-plugin/95448>\
**Category:** Rails\
**Created:** [December 6, 2005, 1:35pm UTC](https://www.ruby-forum.com/t/some-bugs-using-the-globalize-plugin/95448 "2005-12-06T13:35:57Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![jeroen](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/bbe5ce/32.png) [@jeroen](https://www.ruby-forum.com/u/jeroen)\
**Post date:** [December 6, 2005, 1:35pm UTC](https://www.ruby-forum.com/t/some-bugs-using-the-globalize-plugin/95448/1 "2005-12-06T13:35:57Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![jeroen](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/bbe5ce/32.png) [@jeroen](https://www.ruby-forum.com/u/jeroen)\
**Post date:** [December 6, 2005, 1:52pm UTC](https://www.ruby-forum.com/t/some-bugs-using-the-globalize-plugin/95448/2 "2005-12-06T13:52:23Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![jeroen](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/bbe5ce/32.png) [@jeroen](https://www.ruby-forum.com/u/jeroen)\
**Post date:** [December 6, 2005, 3:00pm UTC](https://www.ruby-forum.com/t/some-bugs-using-the-globalize-plugin/95448/3 "2005-12-06T15:00:45Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![jeroen](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/bbe5ce/32.png) [@jeroen](https://www.ruby-forum.com/u/jeroen)\
**Post date:** [December 6, 2005, 7:14pm UTC](https://www.ruby-forum.com/t/some-bugs-using-the-globalize-plugin/95448/4 "2005-12-06T19:14:17Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![jeroen](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/bbe5ce/32.png) [@jeroen](https://www.ruby-forum.com/u/jeroen)\
**Post date:** [December 6, 2005, 4:56pm UTC](https://www.ruby-forum.com/t/some-bugs-using-the-globalize-plugin/95448/5 "2005-12-06T16:56:18Z")

</div>

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
