[Rails] Using globalize and Net::HTTP.get

bathow norimasay at hotmail.com
Sat Apr 1 03:49:08 GMT 2006


Today we did some cool stuff with globalize (the library) and 
Net::HTTP.get. I thought it was pretty awesome, but most people I talked 
to really didn't think so, so I've come here to share my excitement on 
this list w/ ppl who'd understand :P

Anyways, we took globalize and extended it so that websites were 
translated on the fly by Google Translate / Babelfish type services out 
there when someone switched the locale to something Google could 
translate, and there was no entry in the db. (Maybe it should be an add 
on to globalize)

The translation was horrible, but it was a fun hack.

One problem I didn't get over forever which no one seemed to be able to 
help me with is that the content from Net::HTTP.get is not in UTF-8 
form. To convert this, you must use .toutf8 on the string object. It was 
simple, but I spent almost a whole day on this, so I document it here 
for posterity, in case anyon else ever runs into it.

Here are the details. I figured you guys would be interested in it.
http://blog.kenlet.com/articles/2006/03/31/internationalization-with-the-help-of-google-translate

-- 
Posted via http://www.ruby-forum.com/.


More information about the Rails mailing list