HerbGobbler is a software localization tool for Ruby on Rails based websites seeking to translate their website into multiple languages. It aims to assist businesses and localization services with website internationalization. The HerbGobbler enables software internationalization of Ruby on Rails based websites by:
- Parsing a projects Rails Template Code
- Extracting the language specific text
- Combining the text into full sentences for optimal translations
- Moving the text into an localized datastore (Rails YML files by default)
- Replace the language specific text in the Rails Template Code with the Rails method calls(t) to retrieve the text in the desired language
By automating the text extraction process in software internationalization, the HerbGobbler increases quality of the final foreign language translation by implementing industry best practices, while at the same time decreasing the number of bugs that normally occur in the time consuming and tedious foreign localization process.
<div class="bullet"> <div class="description"> If you're on an old version of Rubygems (before 1.3.6) </div> <pre class='sunburst'>Run: $ gem update --system </pre> <div>
<div class="bullet"> <div class="description"> <%= t '.if_you_re_on' %> </div> <pre class='sunburst'>$ <%= t '.run_gem_update' %></pre> <div>
Getting started with the HerbGobbler is easy:
$ gem install herbgobbler
If you're on an old version of Rubygems (before 1.3.6)
$ gem update --system
Use the gobble command to extract all the english text from your .erb files and place the extracted text into the RAILS_ROOT/config/locals/en.yml file
$ gobble i18n -a ~/my/rails/root/
The HerbGobbler is very much beta software. It attempts to implement the best practices in internationalization (i18n) and localization by extracting complete sentences (even when these sentences contain html). If you discover a piece of text that is not being properly extracted, or a pattern of extraction that you think is incorrect, please enter a bug into the system and a patch will be issued.
The Herbgobbler also has experimental tr8n support. By running: $ gobble -tr8n -a ~/my/rails/root
The Herbgobbler will rewrite your erb files with tr8n embed (tr) tags. This is a more beta feature than the rest of the Herbgobbler. If you discover any problems please submit a bug through github being sure to include the block of erb that is causing problems.
HerbGobbler provides several command line options to make text extraction simppler
- -a / --path : Defines the root of the Rails project
- -e / --extension : Defines the extension of the files that will be converted, without a preceeding period.
- -f / --file : Defines a single file to extract text from
If you are interested in exporting text to a different data store than the default rails i18n format (en.yml), this can be done by implementing a TranslationStore.