Reputation: 54
I have a page with brands, tags, comments and products. It's time to go international and I have some question about how to setup the I18n.
I have read some about Internalization and even tried the globalize gem 1 year ago but it's still lot of things I don't know how do handle. I translate the static text on my webpage using the beautiful I18n.translate() method storing every static and semi-static text in a different .yml file. The problem comes when try to keep track of relations depending on language.
Before getting into the problem I show you my database-schema/models. Notice that none of the models has the locale variable yet.
belongs_to :category
has_many :taggings
has_many :tags, :through => :taggings
has_many :comments
belongs_to :product, :counter_cache => true
has_many :products
belongs_to :tag
belongs_to :product
has_many :taggings
has_many :products, :through => :taggings
translate fields
To translate single fields like tag's name or product's description it's
possible to use the globalize2 gem with a separate translation table or
any other gem with the same feature.
comments_count
The comments_count for products is going to show the total amount
of comments, not for a specific language.
tags/taggings
When doing product.first.tags it's going to show all the taggings
regardless of current locale. One solution for this problem could
be to put a locale field in the taggings table but I guess there
is plugins or gems for doing this?
Brand name is international and doesn't change depending on language.
I need advise from someone who know how to handle I18n applications well and the question is simple: how do I solve the problems above? All answers are appreciated.
Upvotes: 3
Views: 2926
Reputation: 135
I use puret http://github.com/jo/puret for translate data. Nice plugin works well, but I have some not yet solved problems when saving nested models with translated fields.
Other alternatives not working with Rails 3 now.
Upvotes: 1