<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -5,18 +5,16 @@
     &lt;meta http-equiv=&quot;Content-Type&quot; content=&quot;text/html;charset=utf-8&quot; /&gt;
     &lt;%= javascript_include_tag :defaults %&gt;
     &lt;title&gt;&lt;%= h(@page_title) %&gt;&lt;/title&gt;
-    
+
 &lt;script type=&quot;text/javascript&quot; src=&quot;http://www.google.com/jsapi&quot;&gt;&lt;/script&gt;
 &lt;script type=&quot;text/javascript&quot;&gt;
       google.load(&quot;language&quot;, &quot;1&quot;);
 
       function getGoogleTranslation(id, text, from_language, to_language) {
-        text = text.replace(/\{\{/, '__').replace(/\}\}/, '__')
+        text = text.gsub(/\{\{/, '___').gsub(/\}\}/, '__')
         google.language.translate(text, from_language, to_language, function(result) {
-          if (!result.error) { 
-            result_text = result.translation.unescapeHTML().gsub(/__(.+)__/, function(match){
-              return '{{' + match[1] + '}}';
-            });
+          if (!result.error) {
+            result_text = result.translation.unescapeHTML().gsub('___', '{{').gsub('__', '}}')
             Form.Element.setValue(id, result_text);
           }
         });
@@ -78,7 +76,7 @@
           if (element.options[i].value == newValue){
             element.selectedIndex = i;
             return true;
-          }        
+          }
         }
       }
     }
@@ -358,3 +356,4 @@
     &lt;/div&gt;
   &lt;/body&gt;
 &lt;/html&gt;
+</diff>
      <filename>views/layouts/translate.rhtml</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>b2719d50872df60e8d5e786180ecff214475aa42</id>
    </parent>
  </parents>
  <author>
    <name>Aimee</name>
    <email>aimee@edendevelopment.co.uk</email>
  </author>
  <url>http://github.com/sermoa/translate/commit/14d94aaf6c4211aecae9cc1a01e8e6561a7c4868</url>
  <id>14d94aaf6c4211aecae9cc1a01e8e6561a7c4868</id>
  <committed-date>2009-06-17T16:10:10-07:00</committed-date>
  <authored-date>2009-06-17T16:10:10-07:00</authored-date>
  <message>Use Prototype's gsub to replace more than one interpolated variable.
Fortunately Google ignores words surrounded by underscores.
The use of two or three underscores helps us put the variable back together again
without worrying about the tricky anonymous function and match variables.</message>
  <tree>716be22bd9d564b310770553a1b2e6ee4bc13c84</tree>
  <committer>
    <name>Aimee</name>
    <email>aimee@edendevelopment.co.uk</email>
  </committer>
</commit>
