Battling Rails Translations with AnnoTranslate

Localization is a complex matter in software development, and it is usually put off as a clean-up task at the end of a project. Content translation is usually contracted out and performed by non-developers, so there’s also a technical gap to overcome.

After battling Qt translations for months on a previous project, I created the AnnoTranslate Rails middleware stack plugin to ease the burden of the developer/translator interfacing and workflow in Rails apps.

Providing Context for Translators

In small-scale Rails apps, providing context information to translators with little-to-no domain knowledge can be painful, but it’s do-able in an ad-hoc fashion. As the breadth and amount of content grows, a more structured workflow is warranted, which leads to the desire to automate the tedium. Enter AnnoTranslate.

Based on the I18n Rails gem, rails-18n, AnnoTranslate builds on its interface for dynamically resolving translated content per locale. Via hooking in to the I18n::translate() method, and its alias I18n::t(), it inserts tooltips that contain the fully-scoped key for each of the translations when they are rendered in the browser.

These tooltips allow translators to easily spelunk through the Rails site for translatable strings, and easily identify the fully-scoped key for every string on the site.

“I’m an… Importer/Exporter” as well!

Rather than trying to make a full-blown translations management tool, which translators will need to use, yet also provide trivial importing/exporting translation tables, AnnoTranslate has your back as well!

Since most any translator is fluent in some spreadsheet program such as Microsoft Excel, Mac Numbers, or even Google Spreadsheets, AnnoTranslate exports Rails locale YAML files into plain old CSV files. Just send them off to the translators and have them translate away.

When any of the translations are complete, the translators can export the transalations table as a CSV. AnnoTranslate can then import the resultant CSV(s) back into your Rails YAML locale files, letting you know if any translations are missing across all updated locales.

The AnnoTranslate Rails plugin can be found here: https://github.com/atomicobject/annotranslate
 

Conversation
  • Charles says:

    Hello Greg! To translate the YAMl files, I have used POEditor, a software localization tool, but first of all I used this free converter tool http://yml2po.com/ to convert it to po files. I thin it’s a good solution.

    • Greg says:

      Charles,

      Thanks for the tip! Looks like a good tool. I’m dealing with localization/translations right now on an Ember.js project right now…

      Have a great holiday season!

  • Charles says:

    Glad it is useful, Greg! Thank you! Happy Holidays to you as well!

  • Comments are closed.