Translates Models(table names, column names) with gettext in rails
How may i translate model name and column name with gettext in ra开发者_JS百科ils ?
Gettext has provided rake task gettext:store_model_attributes. This rake task will create model_attribute.rb file in locale folder.
Example of model_attribute.rb. In your case result will be different.
_('sales rep phone')
_('SalesRepPhone|Sales rep id')
_('SalesRepPhone|Phone type id')
_('SalesRepPhone|Phone no')
_('SalesRepPhone|Compact phone no')
_('SalesRepPhone|Lock version')
Here sales rep phone is model. And Sales rep id, Phone type id are my fields of sales rep phone.
Now run rake task(makepot).It will create msgid for all the rows of model_attribute.rb in app.po.
After modified po file with proper translation. Run the gettext:pack to create new mo files.
Now you will get all the column and model names translated.
精彩评论