"name" , .
, "" , "". "" , :
transtations table
en_text "Other" <--- You search this (default language)
es_text "Otros" ---> You retrun this
ca_text "Altres" ---> or this
class Category < ActiveRecord::Base
def name
Translation.translate(read_attribute("name"))
end
end
class Translation < ActiveRecord::Base
def self.translate(text)
locale=I18n.locale
if locale!="en"
trad=self.find_by_en_text(text)
if trad
return eval("trad.#{locale}_text")
end
end
return text
end
end