Xml File

TerraCool is based on xml files for its catalog, so you can modify this localization files without to recompile anything to update translated strings.

The xml file structure is very simple, it has a root element called 'TerraCool' and two main elements: 'Header' and 'Strings', which is the most important because here we translate the strings.

Example:

<?xml version="1.0" encoding="UTF-8"?>
<TerraCool>
  <Header>
    <Author>Fredy Ramirez</Author>
    <Url>http://www.pacificcoolwave.com</Url>
    <Type>csharp</Type>
    <Locale>es</Locale>
  </Header>
  <Strings>
    <String id="It is a wonderful world!"
            msg="Que mundo maravilloso!"
            id_plural="These are wonderful worlds!"
            msg_plural="Que mundos maravillosos!"/>

    <String id="Special chars: ' \&quot;&lt;&amp;&gt;\&quot;"
            msg="Caracteres especiales: ' \&quot;&lt;&amp;&gt;\&quot;" />

    <String id="C# special chars: \\ \&quot;"
            msg="C# caracteres especiales: \\ \&quot;" />

    <String id="Line 1 \n line 2 \n line 3"
            msg="Linea 1 \n linea 2 \n linea 3" />

    <String id="String 1 and string 2"
            msg="Cadena 1 y cadena 2" />
  </Strings>
</TerraCool>

Notice that specials xml chars must be escaped, so string:

C# special chars: \\ \&quot;

is used to translate

C# special chars: \\ \" --> As it appears in c-sharp source file

Resulting in translated string:

C# caracteres especiales: \ "

 


Last edited Sep 4, 2012 at 5:15 PM by formateli, version 17

Comments

No comments yet.