Permalink
Browse files

Better manage return carriage on yml and gtranslate

  • Loading branch information...
1 parent 8e97ab6 commit 8ffd8f44177b7a8824699cd51a082878d8b1b0a0 @cover committed Nov 26, 2010
Showing with 7 additions and 3 deletions.
  1. +4 −0 app/helpers/tolk/application_helper.rb
  2. +1 −1 app/views/tolk/locales/show.html.erb
  3. +2 −2 public/tolk/application.js
@@ -1,5 +1,9 @@
module Tolk
module ApplicationHelper
+ def format_google_i18n_value(value)
+ h(yaml_value(value))
+ end
+
def format_i18n_value(value)
h(yaml_value(value)).gsub(/\n/, '<br />')
end
@@ -42,7 +42,7 @@
<%= format_i18n_value(((@alternate_locale and phrase.translations.for(@alternate_locale)) || phrase.translations.primary).text) -%>
<% end -%>
</span>
- <span class="to_translate_hidden" style="display:none"><%= h(yaml_value(phrase.translations.primary.text)) %></span>
+ <span class="to_translate_hidden" style="display:none"><%= format_google_i18n_value(phrase.translations.primary.text) %></span>
<span class="key" title="<%= phrase.key %>"><%= truncate(phrase.key, :length => 100) %></span>
</td>
</tr>
@@ -10,8 +10,8 @@ Event.observe(window, 'load', function() {
var target_language = $('target_language').innerHTML;
if (phrase && textarea && $F(textarea).blank()){
- //translate it using google translate, autodetect source language
- var to_trans = phrase.innerHTML;
+ //translate it using google translate, autodetect source language
+ var to_trans = {text:phrase.innerHTML,type:'text'};
google.language.translate(to_trans, "", target_language, function(result) {
if (!result.error) {
textarea.setValue(result.translation);

0 comments on commit 8ffd8f4

Please sign in to comment.