Experimental Rails Application
Saturday, April 16, 2011
As I mentioned yesterday, lately I have been working on a simple Rails application. Shall I quote myself -
Recently I've been working on a simple translation project... The main goal of this application is to translate speech via the web browser. I am doing it with the HTML5 voice recognition. It should also save all the latest translations and post them to the database...
In the last hours I finished sharpening this application. In this post I would like summarize my process and how I managed to get it working.
My application is deployed here. You can view it's source on github.
Again, my application is based on HTML5 voice recognition (there is plenty content written about this feature, google it and you will find articles explaining it). It is currently available only on Chrome 11 beta. In order to make sure that no one is mistaken to view it on a different browser, I used some Javascript browser detector I found in order to redirect these people to an error page.
Just for reference, voice recognition looks like that -
<input type="text" x-webkit-speech>
Integrating this input area with Google Translate API was quite easy actually. As seen in the Developer's Guide, the translation can be procesed via a simple, restful (in REST terms) Javascript code. I didn't really have to change it alot, anyhow the source text is always in English.
From here goes mostly the 'usual stuff' for saving the translations. It didn't need to do anything special, so I simply generated it through a scaffold. I had some issues saving the translations to the database though, because it was done in Javascript. My solution to that was posting them with jQuery.
Saving the user's settings wasn't really a great deal, If you really want to know how It's done, you can take a look at the source code.
That's it for this application, I might imporve the UI sometime later, so I will be pleased with it.
Update 29/4/2011 - Updated link for source code, It is now uploaded on Github.
