Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Ruby on Rails automatic string extraction for translation

I am trying to automatically extract strings from ruby views .erb files to config/lang/ files for example en.yml

Is there some updated alternative to this?

http://zigzag.github.io/2009/12/17/get-your-local-rails-application-ready-for-i18n.html

It is supposed to be a gem tool that will extract strings if used like this:

ready_for_i18n <you view path> <target path>
like image 672
Aleksandar Pavić Avatar asked Oct 16 '25 13:10

Aleksandar Pavić


2 Answers

There is a number of gems that do this. One list of such gems is maintained on the i18n-tasks wiki:

  • Slimkeyfy extracts plain strings from Slim views and Rails Controllers.
  • haml-i18n-extractor automates string extraction from HAML.
  • i15r for ERB and Haml.
  • i18n-html_extractor another extractor for ERB with an interactive mode.
like image 118
glebm Avatar answered Oct 18 '25 03:10

glebm


Try i18n-tasks gem

$ i18n-tasks add-missing
like image 28
glebtv Avatar answered Oct 18 '25 05:10

glebtv



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!