|SINTL(1)||General Commands Manual||SINTL(1)|
sintlutility extracts translatable strings from HTML5 files (
-e), joins XLIFF translation files and untranslated HTML5 files (
-j), and merges new or removed translations (
-u). Its arguments are as follows:
-e, assigns the same target as the source. With
-u, does the same for new entries. By default, in either case the target is left blank. For
-j, missing translations are filled in from the input file's content.
-u, keep entries that are no longer valid. Otherwise is ignored.
-kis specified. Additions and deletions are noted on standard error.
sintl behaves as if
-e were used.
<textarea>.) For example,
<section> <div>foo <i>bar</i> baz</div> foobar </section>
results in two translatable strings: “foo <i>bar</i> baz” and “foobar”.
Contiguous white-space is collapsed into a single space and empty
keys are ignored. This is why the text node preceding the
div is omitted. You may override the whitespace
behaviour with the
attribute, which affects the current and descendent nodes by not trimming
whitespace at all.
Translation may be controlled with the
its:translate attribute, which is set to either
no. When set to
no, descendents of the labelled node are not
examined for translatable content. When set to
the opposite is true.
In a break from standard usage, translations may change attribute values simply by changing the attribute content. For example,
<trans-unit id="unit1"> <source><g id="unit1-1" xhtml:href="foo.html">Hi</g>!</source> <target>Le <g id="unit1-1" xhtml:href="foo.fr.html">hi</g> !</target> </trans-unit>
In this example, the attribute of the translated element will replace that of the source.
sintlperforms a number of optimisations to prevent superfluous content from being considered for translation. First, translation strings consisting only of an empty tag are removed. For example,
<p> <img src="path/to/image.png" /> </p>
These tags may be surrounded by white-space and arbitrarily nested.
Second, tags surrounding text are stripped away. For example,
<p> <a href="a/link.html"><i><strong>Hello.</strong></i></a> </p>
This will produce only the “Hello.” for translation.
sintlutility exits 0 on success, and >0 if an error occurs.
<!DOCTYPE html> <html xmlns:its="http://www.w3.org/2005/11/its"> <head><title>title</title></head> <body><p>hello <img src="foo.jpg" /> world</p></body> </html>
We can then create an initial XLIFF file as follows.
Now edit the XLIFF file.
<xliff version="1.2"> <file source-language="TODO" target-language="en"> <body> <trans-unit id="unit1"> <source>title</source> <target>Title</target> </trans-unit> <trans-unit id="2"> <source>hello <x id="0" xhtml:src="foo.jpg"/> world</source> <target>Hello, World!</target> </trans-unit> </body> </file> </xliff>
lang attribute were specified on
<html> root element, it would have
been propogated in the
It defaults to
TODO. Finally, create a translated
output file as follows.
This can be repeated for as many translation files as necessary. Many systems will use a baseline translation (e.g., English) as the template, but I find it easier to translate based on sources that are identifiers, not content.
sintlutility was written by Kristaps Dzonsons, email@example.com.
sintlignores translation comments within translated phrasing content. For example:
<i>Hello, <span its:translate="no">world</span>.</i>
In this example, the non-translatable content is simply passed into the output. Non-conformant HTML5, with non-phrasing content embedded in phrasing content, is explicitly disallowed. For example:
<i>Hello, <div its:translate="no">world</div>.</i>
|June 28, 2019||OpenBSD 6.5|