title: I18N of XML documents
body: <p>I'm about to decide how to handle internationalisation of an XML-based format for UI description.</p>
  
  <p>The format typically looks something like this:</p>
  
  <pre><code>...
  &lt;devif&gt;
    &lt;screen id="scr1" title="Settings for this and that"&gt;
      &lt;header text="Climate readings"/&gt;
      &lt;rd setp="123" text="Air temperature" unit="°C"/&gt;
      &lt;rd setp="234" text="Humidity" unit="%RH"/&gt;
      &lt;rd setp="345" text="CO2" unit="ppm"/&gt;
  
      &lt;header text="Settings"/&gt;
      &lt;wr setp="567" text="Air temperature demand" unit="°C"/&gt;
    &lt;/screen&gt;
    ...
  &lt;/devif&gt;
  </code></pre>
  
  <p>Each file contains lots of screens and can be up to some 10.000 lines, and we have a dozen of these files in our application.</p>
  
  <p>I can still change the format to best suit our needs. So how would you go about translating this?</p>
  
  <p>I've been thinking about some possible ways to handle this:</p>
  
  <ul>
  <li>A separate file for each language containing the english text and translated text</li>
  <li>Using an ID for each tag and use a separate file with translated text for each id</li>
  <li>Placing all translations in the same file</li>
  </ul>
  
  <p>The first solution has the problem where the english text might be translated into different messages depending on context.</p>
  
  <p>The second solution makes the source file less readable (although not by much), and it does not handle translation of attributes easily.</p>
  
  <p>The third solution would make the file very large and cumbersome to work with once the file has been translated into some 5-6 languages.</p>