Just another localization thread


#1

Hey all,

I was playing w/ Thomas Fuch’s Localization module (thanks Thomas!), and
just realized how hard is to localize an application in Rails :slight_smile:
The Localization module works nice, but the problem is the error
messages. Its not that good to keep the application in [your idiom] and
the error messages in english. I saw the other threads about it,
specially the ones that recommends overriding the default error messages
w/ your own messages by changing rails main code (and similar
approaches), but I (just like many of us) think its too invasive.

So, I think we can make some changes to Rails to use some l10n module by
default (the Thomas Fuch’s one is fine to mee). Rails messages can be
stored in /lang/default.rb w/ something like this:

Localization.define(‘en_US’) do | l |
l.store “internal.error.blank”, “{field} can’t be blank”
end

So, we are able to easily override this w/
/lang/rails.pt-br.rb
Localization.define(‘pt_BR’) do | l |
l.store “internal.error.blank”, “O campo {field} não pode estar
em branco”
end

That way, the applications that doesn’t uses l10n at all doesn’t need to
define the l10n values just for error messages. The default is fine
(just like the current one). And the applications that uses l10n can
override this values.

Since “talk is cheap” ®, I’m a volunteer to make something running
this way. I just need an “ok, do that and lets talk again” or an “shut
up, l10n suxx0r”. And yes, if possible, a rails hacker help is welcome
=)

thanks!
juraci krohling
juca [the at sign] jkcosta dot info


#2

Maybe you should listen in on some of the localization threads in
rails-core. There’s potentially two hang ups.

  1. The core team AFAIK don’t all feel that any of the localization
    plugins are ready for the the big time. Multi-lingual rails is
    getting close imho.
  2. I don’t know that there’s a list of all of the messages in a
    sufficient variety of languages to be useful.

Maybe a good next step would be compiling a table of the error
messages in multiple languages.