I'm about to decide how to handle internationalisation of an XML-based format for UI description.
The format typically looks something like this:
...
<devif>
<screen id="scr1" title="Settings for this and that">
<header text="Climate readings"/>
<rd setp="123" text="Air temperature" unit="°C"/>
<rd setp="234" text="Humidity" unit="%RH"/>
<rd setp="345" text="CO2" unit="ppm"/>
<header text="Settings"/>
<wr setp="567" text="Air temperature demand" unit="°C"/>
</screen>
...
</devif>
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.
I can still change the format to best suit our needs. So how would you go about translating this?
I've been thinking about some possible ways to handle this:
- A separate file for each language containing the english text and translated text
- Using an ID for each tag and use a separate file with translated text for each id
- Placing all translations in the same file
The first solution has the problem where the english text might be translated into different messages depending on context.
The second solution makes the source file less readable (although not by much), and it does not handle translation of attributes easily.
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.