I use to_lang to translate text in Rails 3 application.
I noticed that it converts newlines to spaces.
What is the most appropriate approach to preserve the newlines in the original text?
I don’t want to split the original text by "\n", translate the parts, and then combine them again, since it will increase the number of requests.
Any ideas?
I use to_lang to translate text in Rails 3 application. I noticed that it
Share
I’ve tested it with
:debug => :request:{:key=>"--", :q=>"To prevent abuse, Google places limits on API requests.\nUsing a valid OAuth 2.0 token or API key allows you to exceed \nanonymous limits by connecting requests back to your project.", :target=>"ru"}and as you can see it’s not the gem fault. So,
to_langcan translate arrays too. And if you’ll write something like["one", "two", "three"].to_russianit will be one request to the Google API.UPDATE: