Download
The source is available for download from GitHub. Alternatively, you can install using npm:
npm install --save xliff
You can then require()
xliff as normal:
const xliff = ;
Or you can direclty require()
its functions:
const xliff2js = ;
Usage
XLIFF 2.0
const xliff = `<xliff xmlns="urn:oasis:names:tc:xliff:document:2.0" version="2.0" srcLang="en-US" trgLang="de-CH"> <file id="namespace1"> <unit id="key1"> <segment> <source>Hello</source> <target>Hallo</target> </segment> </unit> <unit id="key2"> <segment> <source>An application to manipulate and process XLIFF documents</source> <target>Eine Applikation um XLIFF Dokumente zu manipulieren und verarbeiten</target> </segment> </unit> <unit id="key.nested"> <segment> <source>XLIFF Data Manager</source> <target>XLIFF Daten Manager</target> </segment> </unit> </file></xliff>`; const js = "resources": "namespace1": "key1": "source": "Hello" "target": "Hallo" "key2": "source": "An application to manipulate and process XLIFF documents" "target": "Eine Applikation um XLIFF Dokumente zu manipulieren und verarbeiten" "key.nested": "source": "XLIFF Data Manager" "target": "XLIFF Daten Manager" "sourceLanguage": "en-US" "targetLanguage": "de-CH"; const xliff2js = ;; const js2xliff = ;; const targetOfjs = ;; const sourceOfjs = ;; const createjs = ;; const createxliff = ;;
XLIFF 1.2
const xliff = `<xliff xmlns="urn:oasis:names:tc:xliff:document:1.2" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="urn:oasis:names:tc:xliff:document:1.2 http://docs.oasis-open.org/xliff/v1.2/os/xliff-core-1.2-strict.xsd" version="1.2" srcLang="en-US" trgLang="de-CH"> <file original="namespace1"> <body> <trans-unit id="key1"> <source>Hello</source> <target>Hallo</target> </trans-unit> <trans-unit id="key2"> <source>An application to manipulate and process XLIFF documents</source> <target>Eine Applikation um XLIFF Dokumente zu manipulieren und verarbeiten</target> </trans-unit> <trans-unit id="key.nested"> <source>XLIFF Data Manager</source> <target>XLIFF Daten Manager</target> </trans-unit> </body> </file> </xliff>` const js = "resources": "namespace1": "key1": "source": "Hello" "target": "Hallo" "key2": "source": "An application to manipulate and process XLIFF documents" "target": "Eine Applikation um XLIFF Dokumente zu manipulieren und verarbeiten" "key.nested": "source": "XLIFF Data Manager" "target": "XLIFF Daten Manager" "sourceLanguage": "en-US" "targetLanguage": "de-CH" const xliff12ToJs = ; ; const jsToXliff12 = ; ; const createxliff12 = ; ;