In my Rails 3 application, users may write messages in forum. I would like to identify what the language is for a given message. I'm interested in English, Russian, and Hebrew languages. Is there any built-in library in Ruby/Rails for such a task? If not, any ideas will be appreciated.
Use this: https://github.com/nashby/wtf_lang
"ruby is so awesome!".lang # => "en"
"ruby is so awesome!".full_lang # => "ENGLISH"
You can use the api provided by google to guess it with google translate.
See here for documentation : http://code.google.com/apis/language/translate/v1/using_rest_langdetect.html
Since you're concerned with languages with different character sets you could dig up the character codes that are predominantly in your strings. You could then see if they fall into the code sets that represent hebrew / cryllic characters.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With