home art portfolio sketches

facebook like translations for your rails app

07 October 2009

Last year I wrote a plugin for Sanbit, the language learning site I was working at the time that allowed you to add a facebook style translation system to your application, I call it Sanbit Translations. When a user turns on translation mode, all the translation strings in your application appear with an underline to notify the user that they can translate those strings. The user then right clicks on the strings and a window popups where the user can add their own translation or vote on the other submitted translations. The plugin uses jquery and the jquery right click plugin to work. When Sanbit Translations sees translation mode turned on (just an instance variable), it then adds a translatable class to all elements in the DOM that are translatable. It is up to you to put in your own styling for how you want the text to look while in translation mode. Using this plugin can help you save time when developing your app because users of the site can help you translate the site into other languages. I didn’t publish the plugin because I wasn’t and am still not satisfied with the design. The plugin has dependencies on specific javascript code, controller code, and views to function properly. I do think the system is really cool though and I’m publishing it now in the hopes of getting feedback and new ideas. The tests are all passing, so please fork away and start editing the code.