sintl(1)
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.

Warning: this tool is still experimental. Its support for the XLIFF and ITS standards will continue to unfold.

The sintl(1) utility 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="http://www.w3.org/2005/11/its">
    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 xmlns="urn:oasis:names:tc:xliff:document:2.0" 
    2  version="2.0" srcLang="en" trgLang="fr">
    3   <file id="file1">
    4     <unit id="unit1">
    5       <segment>
    6         <source>A test file</source>
    7         <target>Un fichier de test</target>
    8       </segment>
    9       <segment>
   10         <source>Hello, <i>world</i>!</source>
   11         <target>Bonjour <i>le monde</i> !</target>
   12       </segment>
   13     </unit>
   14   </file>
   15 </xliff>

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

    1 <!DOCTYPE html>
    2 <html xmlns:its="http://www.w3.org/2005/11/its">
    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 its:translate="no">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. The last versions are as follows: