simple HTML5 translation

sintl is an open source UNIX utility for managing HTML5 translations. It works similarly to itstool, except that it's built exclusively for HTML5, depends only on libexpat, is in C, and works with XLIFF instead of PO files. It is a project.

The sintl(1) executable creates XLIFF templates from HTML5, keeps templates up to date with current translatable content in the HTML5, and joins HTML5 with XLIFF to produce translated output. The HTML5 input uses a simple subset of ITS to indicate what should and should not be translated.

An example input file is as follows.

    1 <!DOCTYPE html>
    2 <html xmlns:its="" lang="en">
    3   <head>
    4     <meta charset="utf-8" /> 
    5     <title>A test file</title>
    6   </head>
    7   <body>
    8     <p>Hello, <i>world</i>!</p>
    9     <p its:translate="no">Don't translate this.</p>
   10   </body>
   11 </html>

Input markup within elements labelled as <span its:translate="yes">this</span> (which is the default) are marked for translation. Phrase elements (<i>, <strong>, etc.) are included in the translatable content to keep paragraphs consistent. The translation dictionary is just an XML file with key-value pairs.

    1 <xliff version="1.2">
    2   <file source-language="en" target-language="fr" tool="sintl">
    3     <body>
    4       <trans-unit id="1">
    5         <source>A test file</source>
    6         <target>Un fichier de test</target>
    7       </trans-unit>
    8       <trans-unit id="2">
    9         <source>Hello, <g id="0">world</g>!</source>
   10         <target>Bonjour <g id="0">le monde</g> !</target>
   11       </trans-unit>
   12     </body>
   13   </file>
   14 </xliff>

Join the translation file with the input file to produce translated content. It's as easy as that.

    1 <!DOCTYPE html>
    2 <html lang="fr">
    3   <head>
    4     <meta charset="utf-8"/> 
    5     <title>Un fichier de test</title>
    6   </head>
    7   <body>
    8     <p>Bonjour <i>le monde</i> !</p>
    9     <p>Don't translate this.</p>
   10   </body>
   11 </html>

To use, download sintl.tar.gz (sha512, archives) and run ./configure and make install as usual. It is designed to work on any modern UNIX operating system, although its target environment is OpenBSD. (If you're on Mac OS X, you should have expat installed from a third-party package manager: the built-in expat does not integrate with pkg-config.)

The last versions are as follows: