Sunday, March 14, 2010

Translations4Rails: an easy way to do Rails i18n localization in NetBeans

Let me introduce Translations4Rails, my new Netbeans plugin that allows you to edit all localizations of a particular key at once.

Let’s see it in action. Notice that file "ru.yml" is empty before plugin invocation:




In the editor, select the translated key. Click "i18n" button on the toolbar:




Plugin will attempt to load translations of the selected key from yml files under config/locales directory of your Rails project. Edit translations and hit Ok:




Done! Let's check the locales:



TODO:
  • configurable path to locales;
  • full Collections support in YAML;
  • get the key at cursor position without a need to fully select one;
  • better toolbar icon :)
Known problems:
  • SnakeYAML is unable to parse an array "order: [ :year, :month, :day ]" (this one was in i18n_demo_app's YAML files), because it violates YAML syntax. These values should be quoted.
  • If the val
    Known problems:
  • SnakeYAML is unable to parse an array "order: [ :year, :month, :day ]" (this one was in i18n_demo_app's YAML files), because it violates YAML syntax. These values should be quoted.
  • If the value being edited is a Collection, then a String will be written to output in yml. This is due to jTable automatic type conversion.
ue being edited is a Collection, then a String will be written to output in yml. This is due to jTable automatic type conversion.

Download module (NBM)  or grab the code from GitHub (GPLv3).

This is an open-source project, developed in my spare time, so, any help is welcome. You can report bugs, submit your patches, suggest improvements or spread the word on forums and microblogs.

1 коммент.:

Luis Zandonadi Bissoli said...

Hello friend, nice plugin! Congratulations.
I made a plugin for i18n ruby on rails in netbeans too.
Take a look if you can:
http://luiszandonadi.heroku.com/en/articles/netbeans/2010-07-11-i18n-rails-with-netbeans

Post a Comment