Rails and localization

I’ve started to learn Rails about a month ago.

It seems wonderful, except for one major issue: localization!

It’s too complicated to develop a serious application in Brazil with
Rails
(or whatever other country with localization rules different from
English).

I mean, how can I validate a number from user’s input such as 1.234,45
and
how can I show it in all views in the same format, although storing it
correctly in database and doing math operations correctly… I used to
develop web sites in Perl a long time ago. It was pretty simple to add
localization support.

In Rails, it seems I would need to use something like number.l, at best,
in
my views… Maybe override String#to_f method could make “number
= ‘1.234,45’.to_f” be
converted to 1234.45, but I’m not that familiar with Ruby already…
But,
how about the oposite? How to do that snippet show correctly?

<%= @project.price %>

I would like ‘1.234,45’ output instead of ‘1234.45’.

It seems I would need something like

<%= @project.price.l %>

at least (and implement Class#l, of course).

Not to say that I would need to create a plugin for overriding the
validates_numericality_of helper. Or, maybe, overriding String#to_f, it
wouldn’t be necessary…

That said, IMHO, as Rails claims to follow the 80/20 rule, it should
really
consider a good suport for basic things like this kind of basic
localization, such as numbers, currency and other charsets, or at least,
good support to utf-8. I understand it is more a problem of Ruby than
Rails, but I think that there should be a huge effort to achieve
localization as easy as with Perl, Python and so on… Unless, most of
the
world will not be satisfied with Rails for serious applications, unless
they need to write only English sites…

More than 50% of the sites in the world are monolanguage in a language
other
than English. So, it should be considered in Ruby/Rails to give a better
support for these applications, for continue claiming their solution is
80/20…

Maybe, the better approach would be embedding this support directly in
the
Ruby language, but I think the Rails users should help on this…

I’ve looked at Globalize, GLoc and some other plugins. These two are for
internationalization, which is not a requirement for most of these
“other
language than English” applications. They usually just need:

  • localization of numbers and currency
  • support for other charsets, or at least utf-8 (or 16)
  • translation of Rails messages, or, at least, the validation error
    messages. I know there are some dirty methods to do that, but I think
    this
    should be embedded directly on Rails with language directories
    containing
    all translated error messages and scaffolding.

Another good topic is scaffolding… I think it should be more flexive.
For
instance, it should be possible for a project having, as an example,
an ‘scaffolding’ directory that should be used instead of the default
ones located at
rails/lib/rails_generator/generators/components/scaffold/templates

Actually, it would be a minimum, since a lot more could be done with
scaffolding, such as creating master-details scaffolding and changing
the
way to deal with dates (having a lot of selects for handling dates is
not
practice at all).

But the issue that concerns me more is localization, no doubt! All the
remaining can be done without too much complexity, but I don’t see a way
of
solving the localization problem in a good way…

Any thought on that?

Rodrigo.

PS.: I would be very glad with Rails if I only had to develop English
sites… :frowning:

Sorry for the duplicated message but I couldn’t send from newsgroup so I
tried directly on google groups. Result: both were published, although
the
newsgroup has arrived too late…

Sorry,

Rodrigo.