best way to internationalize content from database

Hello all.

It's ok to internationalize thing at app using rails, but how to deal
with content from database ?

What's the best aproach ? I don't wanna do things like:

<% if english %>
   <%= obj.name_english%>
<% else %>
   <%= obj.name_japanese%>
<% end %>

The best way is to do all at controller ? model ?

How do you thing is the better approach ?

Thanks

Anderson Leite wrote:

Hello all.

It's ok to internationalize thing at app using rails, but how to deal
with content from database ?

I think that may not be a good approach. I think it's better to keep
translated strings in PO files -- that way, you can hand them off to
translators.

Take a look at fast_gettext for this. It's nicer than Rails' own I18N.

Hello Marnen

"keep translated strings in PO files "

but think about a content management system that users put information
about a new protuct in english and portuguese.

It's easy to use i18n for labels...but.....what about the product
description ??

I can't put product description into a PO file....it has to come from a
database..

Anderson Leite wrote:

Hello Marnen

"keep translated strings in PO files "

but think about a content management system that users put information
about a new protuct in english and portuguese.

It's easy to use i18n for labels...but.....what about the product
description ??

I can't put product description into a PO file....it has to come from a
database..

Quite true. At that point, it makes sense to have a table with
product_id, language_id, and description fields.

Have you considered this http://github.com/joshmh/globalize2 ?