title: Translating multi-line strings in javascript with django
body: <p>I am working on a django application, which need to support multiple languages. This application involves some amount of javascript code. In this javascript code, there are some multi-line strings, which need to be translated.</p>
  
  <p>We have tried this structure:</p>
  
  <pre><code>var $text = gettext('Lorem ipsum dolor sit amet, consectetur adipisicing ' +
                      'elit, sed do eiusmod tempor incididunt ut labore et ' +
                      'dolore magna aliqua. Ut enim ad minim veniam, quis ');
  </code></pre>
  
  <p>This does not work. <code>makemessages</code> stops at the first <code>+</code> sign, so in the <code>.po</code> file it shows up as:</p>
  
  <pre><code>msgid "Lorem ipsum dolor sit amet, consectetur adipisicing "
  </code></pre>
  
  <p>A bit of searching on the net lead to a <a href="http://google-styleguide.googlecode.com/svn/trunk/javascriptguide.xml?showone=Multiline_string_literals#Multiline_string_literals" rel="nofollow">style guide</a>, which recommends the format we are already using for multi-line strings. But that style is not supported by <code>makemessages</code>.</p>
  
  <p>I tried removing the <code>+</code> characters at the end of the lines. Without the <code>+</code> characters, <code>makemessages</code> can find the full string, but it no longer works in the browser.</p>
  
  <p>Does there exist a style for multi-line strings, which is both supported by <code>makemessages</code> and can be expected to work in all major browsers?</p>
  
  <p>So far I have found that what <code>makemessages</code> is actually doing is to replace all single-quoted strings with double-quoted strings and runs the result through <code>xgettext</code> claiming it to be C code.</p>