KWEBAPP-XLIFF(1) General Commands Manual KWEBAPP-XLIFF(1)

kwebapp-xliff
extract and merge translatable strings from kwebapp configurations

kwebapp-xliff [
-c
] -j config [
xliff
]

kwebapp-xliff [
-c
] -j [
config...
] -x [
xliff...
]

kwebapp-xliff [
-c
] -u config [
xliff
]

kwebapp-xliff [
-c
] -u [
config...
] -x [
xliff
]

kwebapp-xliff [
-c
] [
config...
]

The kwebapp-xliff utility extracts, merges, and updates translatable strings from and into a kwebapp(5) configuration. The configuration may be broken apart into several files. The translated strings are used only by kwebapp-javascript(1). By default, kwebapp-xliff extracts all translatable labels. The arguments are as follows:
 
 
Instead of creating an empty target when extracting strings, joining translation, or updating with new translations, fill in the target with the source.
 
 
Merges one or more xliff files with an untranslated config, producing another configuration on standard output containing the translated strings.
 
 
Update the xliff file with new translation labels found in config. The updated translations are emitted on standard output.
 
 
xliff
An XLIFF 1.2 file containing translated strings.
 
 
config
A kwebapp(5) configuration file. There may be multiple files in a single configuration.
When invoked with -j or -u, multiple kwebapp(5) configuration files and XLIFF files as arguments must be broken up by the -x flag, which signals the beginning of the XLIFF files.
Translatable content in kwebapp(5) is limited to jslabel phrases for enumerations and bitfields.
The usual usage sequence is as follows:
  1. Extract translatable content from a kwebapp(5) configuration into an XLIFF file.
  2. Give the XLIFF file a target language and translate the strings.
  3. Merge the XLIFF file back into the original kwebapp(5) with -j. Already-translated labels for the given language are not overriden by default.
  4. Use the produced configuration for further use in kwebapp-javascript(1).
With these steps, integral enumeration values produced by the JSON output of kwebapp-c-source(1) and kwebapp-c-header(1) may be translated into human-readable, language-specific labels.

The kwebapp-xliff utility exits 0 on success, and >0 if an error occurs.

Take a dummy configuration foo.kwbp containing the following:
enum foo { 
  item bar 0 jslabel "bar"; 
  item foo 1 jslabel "foo"; 
};
Begin by extracting translatable strings from the input.
% kwebapp-xliff foo.kwbp 
<xliff version="1.2"> 
  <file target-language="TODO" tool="kwebapp-xliff"> 
    <body> 
      <trans-unit id="1"> 
        <source>bar</source> 
      </trans-unit> 
      <trans-unit id="2"> 
        <source>foo</source> 
      </trans-unit> 
    </body> 
  </file> 
</xliff>
Change the language into something useful, such as “fr”, and translate the strings into “le bar” and “le foo”, respectively. Then join the output, foo.fr.xliff, with the input configuration.
% kwebapp-xliff -j foo.kwbp foo.fr.xliff 
enum foo { 
  item bar 0 
    jslabel "bar" 
    jslabel.fr "le bar"; 
  item foo 1 
    jslabel "foo" 
    jslabel.fr "le foo"; 
};
This output file can then be used with kwebapp-javascript(1) to have per-language label filling.
Multiple configuration files, when joining, may also be specified.
% kwebapp-xliff -j foo1.kwbp foo2.kwbp -x foo.fr.xliff
The configuration or XLIFF files may also be passed on standard input by omitting the file. In the first case, the configuration is omitted. (The special “--” is used to prevent -x from being interpreted as a command-line option.) In the second case, it's the translation file.
% kwebapp-xliff -j -- -x foo.fr.xliff < foo.kwbp 
% kwebapp-xliff -j foo1.kwbp foo2.kwbp -x < foo.xliff

kwebapp-javascript(1), kwebapp(5)
September 6, 2018 OpenBSD 6.3