[Nitro] [PATCH] support for localization in table-helper

Michael Fellinger manveru at weez.co.jp
Thu Apr 20 22:48:18 EDT 2006

Oh sure i've seen it :)
But Bable doesn't help you with localization that doesn't come from Og.
This is where Glue::Localization comes in, you give it an hash per language 
and it uses Glue::Localization::get(session[:LOCALE])[("string"||:symbol)]
to fetch the right snippet out of that hash
so if you define for example for the localization
:en = {
  :world => "world",
  :hello => "hello",
  :Hello => "Hello",
  :exclamation_mark => "!"
:de = {
  :world => "Welt",
  :hello => "hallo",
  :Hello => "Hallo",
  :exclamation_mark => "!"

and you put in your template
[[Hello]] [[world]][[exclamation_mark]]

then you get for session[:LOCALE] = :en
"Hello world!"
for :de
"Hallo Welt!"

However, this didn't work with the TableHelper, so i had to create a Patch for 

Hope that explains it.

now you can do
#{table :values => ["[[hello]]", "[[world]]"]} and it will be translated...

On Friday 21 April 2006 09:10, Bryan Soto wrote:
> On 4/20/06, Michael Fellinger <manveru at weez.co.jp> wrote:
> > One thing that bugged me for quite a while is that the table-helper is
> > not included in the pipelines, so i had to make a workaround for
> > localization so that [[something]] will be replaced by the content of
> > @lc[something] it works well so far... please let me know if you have
> > problems using that patch...
> > also there should be some more elegant solution possible, but i just
> > couldn't find a better way :|
> I'll see what I can do with it, though I don't have much experience
> with localization. By the way, did you see babel?
> http://rubyforge.org/pipermail/nitro-general/2006-April/003702.html
> --
> "Never tell people how to do things. Tell them what to do and they
> will surprise you with their ingenuity." —General George S. Patton
> _______________________________________________
> Nitro-general mailing list
> Nitro-general at rubyforge.org
> http://rubyforge.org/mailman/listinfo/nitro-general

More information about the Nitro-general mailing list