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 BSD.lv 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 ="http://www.w3.org/2005/11/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:
Version 0.2.11 (2020-10-24 ):
Bring up to date with newest
oconfigure
and add initial shim for regression testing.
No functional change.
Version 0.2.10 (2020-03-11 ):
Allow for much more portable builds (now enforced by a CI system).
Uses with newest
oconfigure .
Version 0.2.9 (2020-01-15 ):
Make <meta>
tag be embeddable in
non-<head>
content.
This is allowed for microdata, and sintl
simply lets it in all cases.
Also bring up to date with newest oconfigure .
Version 0.2.8 (2019-06-28 ):
Bring up to date with newest oconfigure .
and spruce up web site.
No code change otherwise.
Version 0.2.6 (2018-08-02 ):
Add a -q mode, by default having the update sequence emit a
message when translations are added/deleted.
Work better with attributes: allow targets to override attributes in
the source.
This is… not really part of XLIFF, but sorely missing.
Document this in the manpage.
Version 0.2.5 (2018-07-30 ):
Fix update mode (-u ).
Also fix joining reduced sources—before, they would fail to
match properly even though they were the same.
Lastly, add a copy mode (-c ) to both updating and extracting.
This provides an initial translation and also makes testing
much easier.
Version 0.2.4 (2018-07-25 ):
Add in more reduction semantics (e.g., stripping away surrounding empty
nodes).
Also handle null elements (e.g., <img />
) properly in
serialising content.
Don't let null nodes accept children, too.
Run AFL extensively on
all methods of operation.
Also, fully support the <x />
and
<g></g>
replacement of inline content.
Version 0.2.3 (2018-07-14 ):
Revert to using XLIFF 1.2 after realising that most tools to handle the
newest XLIFF standard version.
Have -u mode not keep old translations by default.
Add -k to keep old translations when updating.
Continue working on reducing translatable fragments.
Version 0.2.2 (2018-07-12 ):
Handle space preservation during the parse itself, not afterward.
This will (in the future) handle xml:space
attributes in
embedded phrasing content.
Version 0.2.1 (2018-07-10 ):
Add initial reduction and minimisation.
These optimise translatable content to remove superfluous tags.
Version 0.2.0 (2018-07-08 ):
Use oconfigure for
configuration.
Fix an assertion failure.
Allow for nested elements in <source>
and
<target>
as defined by the ITS standard, but disallow
broken phrase element scoping.
Update manual.
Version 0.1.2 (2016-06-12 ):
Preserve <target>
's nested elements.
Add support for pledge(2) and
Apple's sandbox.
Upload to GitHub , modernise site and style
for manual.
Version 0.1.1 (2014-12-09 ):
Cleaned up internals for readability (no fixes).
Added some missing error-message reporting.
Also have the -u merge option merge both ways: if a new entry is
found, it is merged into the XLIFF file; if it already exists in the XLIFF
file, it is kept as-is.
Version 0.1.0 (2014-12-08 ):
Initial public release.
This utility is very experimental for the time being, but works for me .