开发者

Translates Models(table names, column names) with gettext in rails

开发者 https://www.devze.com 2023-01-29 19:01 出处:网络
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

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.

0

精彩评论

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

关注公众号