Finally it's time to internationalize your Ruby on Rails or Sinatra web application. That's when you realize that you have to painstakingly go through every ERB template, replace every single string literal with a translation helper, and move the original text into a YAML locale file.
No more. Textractor parses ERB templates, converts text into t()
calls and generates the YAML locale file.
We automatically recognize string interpolation, so
There are <%= @posts.count %> posts
becomes
<%= t('there_are_posts_count', posts_count: @posts.count) %>
and your YAML file will contain
there_are_posts_count: There are %{posts_count} posts.
This means you're all set for languages with a different word order than your own.
We also support the most common Rails helpers, so
<%= link_to 'posts overview', posts_url %>
becomes
<%= link_to t('posts_overview'), posts_url %>
If you frequently use other helpers, just let us know, and we'll be happy to add support for those.
The keys in your YAML file are based on the paths of your templates. For example, the string literal Posts overview
in app/views/posts/index.html.erb
would have the key: posts.index.posts_overview
SLIM/HAML support coming soon.