l10n

0 views
Skip to first unread message

Lawrence Pit

unread,
Dec 14, 2007, 2:06:55 AM12/14/07
to rails-...@googlegroups.com
Hi All,

Next to localizing ui texts (i.e. strings in my code) I also need to be able to translate strings in various columns from the database. Is there a plugin / gem out there that can deal with this situation?




Cheers,
Lawrence

Adam Salter

unread,
Dec 14, 2007, 4:33:30 AM12/14/07
to rails-...@googlegroups.com
Look at gibberish.
It adds a hash operator to strings so that:
"Welcome to my site."[:japanese]

can be looked up in a string db.

It probably does more too, but that's enough for me.

Phil Oye

unread,
Dec 14, 2007, 7:09:19 AM12/14/07
to rails-...@googlegroups.com
> Look at gibberish.
> It adds a hash operator to strings so that:
> "Welcome to my site."[:japanese]


There's also Globalize
http://www.globalize-rails.org/globalize/

From the site:
> Dates, currencies, etc: language dependent, but also (often)
> country/locale dependent. This feature provides convenient methods
> for relevant data types. 12345.67.localize → 12.345,67
> Content in the database, for specific fields in specific tables:
> once the translates method is added to the relevant model, the
> fields indicated with that method call gain the ability to have
> translated content sitting in the database. An operator (possibly
> the developer) will need to add these translated texts.
> Arbitrary strings: any string that you would like, with added
> flexiblity for including parameters (for example: ‘one’ in the
> singular form of a phrase and an actual number for the plural form)
> Using these three mechanisms, all user-facing content ought to be
> translatable.
>
p.

Nathan de Vries

unread,
Dec 16, 2007, 8:10:00 AM12/16/07
to rails-...@googlegroups.com
On 14/12/2007, at 6:06 PM, Lawrence Pit wrote:
> Next to localizing ui texts (i.e. strings in my code) I also need
> to be able to translate strings in various columns from the
> database. Is there a plugin / gem out there that can deal with this
> situation?

There's a Ruby wrapper for GNU Gettext [1].

--
Nathan de Vries

[1] http://manuals.rubyonrails.com/read/chapter/105

Lawrence Pit

unread,
Dec 16, 2007, 9:15:07 PM12/16/07
to rails-...@googlegroups.com

I don't see how gibberish would work for me. Or GetText, except possibly when you use this plugin:

http://tinyurl.com/32w9eh

I also had a look at this useful matrix:

http://wiki.rubyonrails.org/rails/pages/InternationalizationComparison


Globalize seems to be the only promising one:


> Supports translation of views and db content



Going to play now...




Thanks,

Lawrence Pit


Phil Oye wrote:

Tim Lucas

unread,
Dec 16, 2007, 10:50:13 PM12/16/07
to rails-...@googlegroups.com
On 17/12/2007, at 1:15 PM, Lawrence Pit wrote:

>
> I don't see how gibberish would work for me. Or GetText, except
> possibly when you use this plugin:
>
> http://tinyurl.com/32w9eh
>
> I also had a look at this useful matrix:
>
> http://wiki.rubyonrails.org/rails/pages/InternationalizationComparison
>
>
> Globalize seems to be the only promising one:
>
>
> > Supports translation of views and db content
>
>
> Going to play now...

I'd be tempted to use Gibberish for view strings and your own method
for localising DB content. There's no silver bullets in this dept I'm
afraid.

If you need not just text but image and layout localisation maybe
you're better off going with some kind of view convention like:

apps/views/articles/show.en_au.html.erb
apps/views/articles/show.zh_tw.html.erb

app/views/layouts/application.en_au.html.erb
app/views/layouts/application.zh_tw.html.erb

and combining that with gibberish for model/controller strings as well
as some ActiveRecord convention for getting localised content. Depends
what you want.

-- tim

Reply all
Reply to author
Forward
0 new messages