Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there a tool for assisting with ruby/rails internationalization? [closed]

I'm looking for something that will help me to internationalize an existing rails application using I18n. Ideally it would locate string constants (with parameters) and allow me to extract those into a .yml or .rb file replacing the original string with the appropriate t(...) call. Also, or alternatively, a macro to do the same on selected text. I mainly use eclipse but could use something else for this task (vim?) as long as it is free to use.

There appears to be a plugin for TextMate that does the job (though mainly for new code) and I know that rgettext/xgettext will do a similar job for gettext localization but I was wondering if anyone knew of anything to make the job easier with I18n.

like image 312
Shadwell Avatar asked Aug 24 '10 08:08

Shadwell


People also ask

What is I18n in Rails?

The Ruby I18n (shorthand for internationalization) gem which is shipped with Ruby on Rails (starting from Rails 2.2) provides an easy-to-use and extensible framework for translating your application to a single custom language other than English or for providing multi-language support in your application.

What is I18n t?

Internationalization (i18n) is the process of preparing software so that it can support local languages and cultural settings. An internationalized product supports the requirements of local markets around the world, functioning more appropriately based on local norms and better meeting in-country user expectations.


2 Answers

Here are a few Gems, github search for 'i18n' in Ruby:

https://github.com/balinterdi/i15r

https://github.com/zigzag/ready_for_i18n

https://github.com/japetheape/gettext_to_i18n

https://github.com/Bertg/i18n_extractor

From my cursory assessment, i15r looks the best and the most up-to-date. I'll likely using one of these soon (chances are i15r) to at least get a starting point - inserting <%=t "translate me please" -%> hundreds of times will drive me nuts before too long; this could be a shortcut for the initial phase.

Hope this helps!

like image 138
James Avatar answered Nov 09 '22 20:11

James


I'm not sure if it does exactly what you're after, but you might find DHH's Tolk project to be useful.

like image 22
John Topley Avatar answered Nov 09 '22 20:11

John Topley