Ruby on ZiGzAg About GitHub LinkedIn Twitter RSS

Ready_for_i18n 0.3 released — support for non-english projects.

31 Dec 2009 – Beijing

In the initial version of ready_for_i18n(Introduced here), We had an assumption that the locale of your project to be extracted is English, therefore the key in the dictionary file can be just come from the literal word. But there are also so many non-english local projects that need to be internationalized. So we come out an idea to introduce a simple key-text mapping mechanism. Still simply using one command of ready_for_i18n and follow these steps to get you non-english project ready for i18n.

(Assuming you are in the app/views directory of your rails project.)

  1. Using ready_for_i18n . --nokey > cn.txt to extract all text and label in your views.
  2. Open the cn.txt and go for google translate (or other tools you like or do it manually) then paste the result in a new file called en.txt with the following cautions — (Do NOT change anything in cn.txt but you can change the translated en.txt just remember keeping the same line number of en.txt with cn.txt).
  3. Using ready_for_i18n . . --keymap=cn.txt:en.txt > cn.yml Then all your views will be replaced to an i18ned version and the generated cn.yml dictionary file will use the keys from en.txt and values from cn.txt.

That is it. It is a bit more steps than extracting the English project, but still simple enough, right?
Besides, if you do not satisfied with the default simple key mapping for your English local project, you can also using this way to change you key mapping as your will.

The 0.3 version of ready_for_i18n also contain some bug fixes and the following enhancements:


Well, Hope this tool will help you in the coming year! Looking forward to your comments.

Happy new year!


Fork me on GitHub