开发者

Why should I use Globalize2 for I18n in the database in Ruby on Rails?

I wonder why I would Globalize2 for translating my table columns in Rails.

Basically what Globalize2 does is to add a new table for the original one, where you have the locale column and the translated columns.

eg.

Threads: id, created_at, updated_at
Thread_translations: id, thread_id, locale, title, body, created_at, updated_at

I wonder why I should use this.

Isn't it better to just add a locale column in the original table?

What is the purpose of Globaliz开发者_如何学Pythone2 adding an extra table for this?

It can't be just for the separation, cause it makes no sense at all for me.

Thanks


Think to have a "products" table where you want to save infos about your items (description, cost, quantity...)

With globalize2 the price will not be duplicated to each row as it will be stored in products.

If you add the local column, if you have to change the cost or the quantity, you have to do it to each row (language).

Globalize2 or this solution allow you to avoid duplications and inconsistencies.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜