{"_id":"@articulate/xliff","_rev":"184-af48411a82c77bb00241fea57545ed65","name":"@articulate/xliff","dist-tags":{"latest":"4.2.0"},"versions":{"4.1.0":{"name":"@articulate/xliff","version":"4.1.0","description":"xliff2js and js2xliff converter xliff utils","main":"index.js","engines":{"node":">=4.0.0"},"dependencies":{"xml-js":"1.6.7"},"devDependencies":{"eslint":"^4.4.1","expect.js":"^0.3.1","mocha":"^5.0.5"},"scripts":{"lint":"eslint .","test":"npm run lint && mocha test/**"},"keywords":["xliff","json","js","translation"],"author":{"name":"articulate"},"license":"MIT","repository":{"type":"git","url":"git+https://github.com/articulate/xliff.git"},"gitHead":"97824fd29b6d99b7ebcba551a28b85de812f6690","bugs":{"url":"https://github.com/articulate/xliff/issues"},"homepage":"https://github.com/articulate/xliff#readme","_id":"@articulate/xliff@4.1.0","_npmVersion":"6.1.0","_nodeVersion":"8.11.1","_npmUser":{"name":"spencerfdavis","email":"spencerfdavis@gmail.com"},"dist":{"integrity":"sha512-+OKkRJnaawymd3oX1fFbPJrWPyvbeEEQmNW/OyarydU+rjm4080h91jEk5LiyDP4t+fedmyvoFZAlaUOnUETbA==","shasum":"65216f488d50ce7d20c4e5fbd5a5ec6574c196c9","tarball":"https://registry.npmjs.org/@articulate/xliff/-/xliff-4.1.0.tgz","fileCount":74,"unpackedSize":119821,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJbmY5LCRA9TVsSAnZWagAAgmwP/05wz/eqEEwfAIBwWSY+\nrLtwVUVyGJRfHI61c+Jud+e5uioHfssXHA9EK1OLW5vRKwUF04NazvVWs1m2\nY2yXxybPmSXhRFfaPa1xl4XtF1ba1Sbtxlqor52gyvgpWDtCEfGzu55cy/Qh\nX+EI28+aikWRA0uL3Dtf9b4u19905MNp3u3qh/Pj98JE/5Ewxa71OejK/pAs\nJLL9CI7M1omzbSGxj/IT478IcAmZSHI2vtd1AadhTl6JH8YEeWPDQFzMTcBt\nTVnpOOpPUCQnJGd1utNOnRA4S2u5FmG65z//SqlydhFKXqECGMfbST8YK3AM\nGig4wvtvFCL/QkPH24CCFLmAsZO7lL5OViUbCaeWZ8CNCSFucM9XXQo2ehFg\nOERPPSsbBc3iBpjBp0Mvd/LMo9NldgVoOyKx0jJa3IUyNAHZ1s4pov0LE6Do\n3uhNPHtyLVm1vModj8VTbS6m60xRcvS65Vau0w3R7s5BGq+oFBIuc0ZIbGjQ\n+MkvVX5ucYBAgfIqGl9iz9gYJSiZjU/WP0laib5Of2u85g4sL712Cy92B+8h\nQHHmbjNY7zq9bor+7geIqGBLYBKKL60hdDHTjsd6em70P4K6w8nncLMMeizL\nuddIIL83ClP/tMdpnBTJoPpDbsnfIt0xxTGwpFqTUFyqoZP97ReXosSUX16X\n8dLg\r\n=SRRj\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCHwaB3b7l8OK1kK7WJd/xIK2sV7L4kr3zPQYSmqcNbMECIQCBtfejUwAv3P15022fyXS0/EKGBW6+VAZ4VfrTycFuHA=="}]},"maintainers":[{"name":"articulateadmin","email":"admin@articulate.com"},{"name":"botzo","email":"platform@articulate.com"},{"name":"cdwills","email":"craig.d.wills@gmail.com"},{"name":"chazu","email":"chaz@plaidpotion.com"},{"name":"darrenwhite","email":"darrenw@articulate.com"},{"name":"defn","email":"npm@defn.us"},{"name":"doneill","email":"danieloneilldev@outlook.com"},{"name":"evil","email":"evilsoft@aol.com"},{"name":"fbguillo","email":"blake.guilloud@gmail.com"},{"name":"flintinatux","email":"mccormack.scott@gmail.com"},{"name":"fromonesrc","email":"aochonicki+npmjs@articulate.com"},{"name":"jamesadams11","email":"jameswadams11@gmail.com"},{"name":"jasminabasurita","email":"jasminejacquelin@gmail.com"},{"name":"jrpz","email":"jperez@articulate.com"},{"name":"kdstew","email":"kstewart@articulate.com"},{"name":"mcurran","email":"mcurran@articulate.com"},{"name":"mgreystone","email":"markus.greystone@gmail.com"},{"name":"mikeolivieri","email":"mike@articulate.com"},{"name":"nicerhugs","email":"jscheuring@gmail.com"},{"name":"patrickeakin","email":"p.w.eakin@gmail.com"},{"name":"pklingem","email":"patrick.klingemann@gmail.com"},{"name":"racheldonovan","email":"rdonovan@articulate.com"},{"name":"rpearce","email":"me@robertwpearce.com"},{"name":"siljil","email":"jsilver@articulate.com"},{"name":"spencerfdavis","email":"spencerfdavis@gmail.com"},{"name":"spurr","email":"spurr@articulate.com"},{"name":"tchamblee","email":"tchamblee@articulate.com"},{"name":"tecnobrat","email":"brian@tecnobrat.com"},{"name":"vamseek","email":"vamsee@articulate.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/xliff_4.1.0_1536790090299_0.22899709705583327"},"_hasShrinkwrap":false,"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info."},"4.2.0":{"name":"@articulate/xliff","version":"4.2.0","description":"xliff2js and js2xliff converter xliff utils","main":"index.js","engines":{"node":">=4.0.0"},"dependencies":{"xml-js":"1.6.7"},"devDependencies":{"eslint":"^4.4.1","expect.js":"^0.3.1","mocha":"^5.0.5"},"scripts":{"lint":"eslint .","test":"npm run lint && mocha test/**"},"keywords":["xliff","json","js","translation"],"author":{"name":"articulate"},"license":"MIT","repository":{"type":"git","url":"git+https://github.com/articulate/xliff.git"},"gitHead":"f590b5fcc573ca60768fc87c1948ba1269b15ee7","bugs":{"url":"https://github.com/articulate/xliff/issues"},"homepage":"https://github.com/articulate/xliff#readme","_id":"@articulate/xliff@4.2.0","_npmVersion":"5.10.0","_nodeVersion":"8.11.1","_npmUser":{"name":"spencerfdavis","email":"spencerfdavis@gmail.com"},"dist":{"integrity":"sha512-adoqeC4znvjQw+xfQidv4W6w5vpKPsOiIqpXq5Tao3/12Bsh472s1zzY0RLAdMyNt4imPK9wd3fTjjd1o78Abg==","shasum":"2c71329d950cc24d31c900bfed0222e2ac0898ef","tarball":"https://registry.npmjs.org/@articulate/xliff/-/xliff-4.2.0.tgz","fileCount":74,"unpackedSize":120266,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJb0fpHCRA9TVsSAnZWagAAlSIP/3clKpxWsDvJHZLMbSep\nkmbzlNVPguKD8Omkt4HOTMCQRDNTmtywsPpZCdvQL6qIFcf4h8Qcwzz2ygVm\nIT5Iq9FuotLuaJrQDlGlOEjnJEqwCMyqJ90MbgxdFCVBWaewi+w3CaOg1dvf\n1zQcy0wygePlG2Gm1jYrEDULYaCMJMC29OpS/DycvGxWXz3tU1eFAYHa5WSI\nxFjN0iviy75dLk0lcHOePm82fM5rq4YFo2FO6v7NItB3fikh88DsVCkvixzU\n56AjUck0eJrshfI1ZfK+7G3BQdkQ6DvwZ8vRQzVpSzY6novZAvGAFc2YKW54\nKf/hMnf5yn9qH1xvEhBMOpSoHCgjQ8WXgl/Efpy5kgH1W6qmEAMD5Gt4H3pt\nkMNP/cXUPtKepkdoBbYX8IWMZ59mmHxYFmnUsiUyWdq6JDS60vz0HoM4zGxF\n+hKmZrnFZJJhsl/qtWXRaHgZvgEUtrkGaeQeINMK+44YbhyiLvlqC4MBiHQH\nl1mdxZoNDpe8DfG89G0YdL51NfAoVzqD8plnKj3LacAU5gpVGiag5rYSpufp\ngSxr9JT2dhMtvCwEtCCna7FbBr8DnLY2H9zMLXtcc491DqJH8eR4+XVnZSzk\nJ1fcCPQMECILQ4Zsa4l768syJicmEikRIgCbjhRWEaAQxOz5PcIag7ID8dYR\nsLhL\r\n=PDDz\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQD+YQb+PpZW1mf4Xy9W1UXI/S7KGb3tv5pfy3pHV5xepgIhAM5S1OQWNB8FJGYZvwHexogRHA3clV1N8DX83NEtec1D"}]},"maintainers":[{"email":"admin@articulate.com","name":"articulateadmin"},{"email":"platform@articulate.com","name":"botzo"},{"email":"bschemmel@articulate.com","name":"bschemmel"},{"email":"craig.d.wills@gmail.com","name":"cdwills"},{"email":"chaz@plaidpotion.com","name":"chazu"},{"email":"darrenw@articulate.com","name":"darrenwhite"},{"email":"npm@defn.us","name":"defn"},{"email":"danieloneilldev@outlook.com","name":"doneill"},{"email":"evilsoft@aol.com","name":"evil"},{"email":"blake.guilloud@gmail.com","name":"fbguillo"},{"email":"mccormack.scott@gmail.com","name":"flintinatux"},{"email":"aochonicki+npmjs@articulate.com","name":"fromonesrc"},{"email":"jameswadams11@gmail.com","name":"jamesadams11"},{"email":"jasminejacquelin@gmail.com","name":"jasminabasurita"},{"email":"jperez@articulate.com","name":"jrpz"},{"email":"kstewart@articulate.com","name":"kdstew"},{"email":"mcurran@articulate.com","name":"mcurran"},{"email":"markus.greystone@gmail.com","name":"mgreystone"},{"email":"mike@articulate.com","name":"mikeolivieri"},{"email":"jscheuring@gmail.com","name":"nicerhugs"},{"email":"p.w.eakin@gmail.com","name":"patrickeakin"},{"email":"patrick.klingemann@gmail.com","name":"pklingem"},{"email":"rdonovan@articulate.com","name":"racheldonovan"},{"email":"me@robertwpearce.com","name":"rpearce"},{"email":"jsilver@articulate.com","name":"siljil"},{"email":"spencerfdavis@gmail.com","name":"spencerfdavis"},{"email":"spurr@articulate.com","name":"spurr"},{"email":"tchamblee@articulate.com","name":"tchamblee"},{"email":"brian@tecnobrat.com","name":"tecnobrat"},{"email":"vamsee@articulate.com","name":"vamseek"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/xliff_4.2.0_1540487751073_0.11077144281440954"},"_hasShrinkwrap":false,"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info."}},"time":{"created":"2018-09-12T22:08:10.209Z","4.1.0":"2018-09-12T22:08:10.529Z","modified":"2024-04-24T15:53:58.861Z","4.2.0":"2018-10-25T17:15:51.308Z"},"maintainers":[{"email":"platform@articulate.com","name":"botzo"}],"description":"xliff2js and js2xliff converter xliff utils","homepage":"https://github.com/articulate/xliff#readme","keywords":["xliff","json","js","translation"],"repository":{"type":"git","url":"git+https://github.com/articulate/xliff.git"},"author":{"name":"articulate"},"bugs":{"url":"https://github.com/articulate/xliff/issues"},"license":"MIT","readme":"[![travis](https://img.shields.io/travis/locize/xliff.svg)](https://travis-ci.org/locize/xliff) [![npm](https://img.shields.io/npm/v/xliff.svg)](https://npmjs.org/package/xliff)\n\n## Download\n\nThe source is available for download from\n[GitHub](https://github.com/locize/xliff/archive/master.zip).\nAlternatively, you can install using npm:\n\n```sh\nnpm install --save xliff\n```\n\nYou can then `require()` xliff as normal:\n\n```js\nconst xliff = require('xliff');\n```\n\nOr you can directly `require()` its functions:\n\n```js\nconst xliff2js = require('xliff/xliff2js');\n```\n\n## Usage\n\n##### XLIFF 2.0\n\n```js\n\nconst xliff = `<xliff xmlns=\"urn:oasis:names:tc:xliff:document:2.0\" version=\"2.0\" srcLang=\"en-US\" trgLang=\"de-CH\">\n  <file id=\"namespace1\">\n    <unit id=\"key1\">\n      <segment>\n        <source>Hello</source>\n        <target>Hallo</target>\n      </segment>\n    </unit>\n    <unit id=\"key2\">\n      <segment>\n        <source>An application to manipulate and process XLIFF documents</source>\n        <target>Eine Applikation um XLIFF Dokumente zu manipulieren und verarbeiten</target>\n      </segment>\n    </unit>\n    <unit id=\"key.nested\">\n      <segment>\n        <source>XLIFF Data Manager</source>\n        <target>XLIFF Daten Manager</target>\n      </segment>\n    </unit>\n  </file>\n</xliff>`;\n\nconst js = {\n  \"resources\": {\n    \"namespace1\": {\n      \"key1\": {\n        \"source\": \"Hello\",\n        \"target\": \"Hallo\"\n      },\n      \"key2\": {\n        \"source\": \"An application to manipulate and process XLIFF documents\",\n        \"target\": \"Eine Applikation um XLIFF Dokumente zu manipulieren und verarbeiten\"\n      },\n      \"key.nested\": {\n        \"source\": \"XLIFF Data Manager\",\n        \"target\": \"XLIFF Daten Manager\"\n      }\n    }\n  },\n  \"sourceLanguage\": \"en-US\",\n  \"targetLanguage\": \"de-CH\"\n};\n\nconst xliff2js = require('xliff/xliff2js');\nxliff2js(xliff, (err, res) => {\n  // res is like js\n});\n\nconst js2xliff = require('xliff/js2xliff');\njs2xliff(js, (err, res) => {\n  // res is like xliff\n});\n\nconst targetOfjs = require('xliff/targetOfjs');\ntargetOfjs(js, (err, res) => {\n  // res is:\n  // {\n  //   \"key1\": \"Hallo\",\n  //   \"key2\": \"Eine Applikation um XLIFF Dokumente zu manipulieren und verarbeiten\",\n  //   \"key.nested\": \"XLIFF Daten Manager\"\n  // }\n});\n\nconst sourceOfjs = require('xliff/sourceOfjs');\nsourceOfjs(js, (err, res) => {\n  // res is:\n  // {\n  //   \"key1\": \"Hello\",\n  //   \"key2\": \"An application to manipulate and process XLIFF documents\",\n  //   \"key.nested\": \"XLIFF Data Manager\"\n  // }\n});\n\nconst createjs = require('xliff/createjs');\ncreatejs(\n  js.sourceLanguage,\n  js.targetLanguage,\n  {\n    \"key1\": \"Hello\",\n    \"key2\": \"An application to manipulate and process XLIFF documents\",\n    \"key.nested\": \"XLIFF Data Manager\"\n  },\n  {\n    \"key1\": \"Hallo\",\n    \"key2\": \"Eine Applikation um XLIFF Dokumente zu manipulieren und verarbeiten\",\n    \"key.nested\": \"XLIFF Daten Manager\"\n  },\n  'namespace1',\n  (err, res) => {\n  // res is like js\n});\n\nconst createxliff = require('xliff/createxliff');\ncreatexliff(\n  js.sourceLanguage,\n  js.targetLanguage,\n  {\n    \"key1\": \"Hello\",\n    \"key2\": \"An application to manipulate and process XLIFF documents\",\n    \"key.nested\": \"XLIFF Data Manager\"\n  },\n  {\n    \"key1\": \"Hallo\",\n    \"key2\": \"Eine Applikation um XLIFF Dokumente zu manipulieren und verarbeiten\",\n    \"key.nested\": \"XLIFF Daten Manager\"\n  },\n  'namespace1',\n  (err, res) => {\n  // res is like xliff\n});\n```\n\n##### XLIFF 1.2\n\n```js\n\n  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\">\n    <file original=\"namespace1\">\n      <body>\n        <trans-unit id=\"key1\">\n          <source>Hello</source>\n          <target>Hallo</target>\n        </trans-unit>\n        <trans-unit id=\"key2\">\n          <source>An application to manipulate and process XLIFF documents</source>\n          <target>Eine Applikation um XLIFF Dokumente zu manipulieren und verarbeiten</target>\n        </trans-unit>\n        <trans-unit id=\"key.nested\">\n          <source>XLIFF Data Manager</source>\n          <target>XLIFF Daten Manager</target>\n        </trans-unit>\n      </body>\n    </file>\n  </xliff>`\n\n  const js = {\n    \"resources\": {\n      \"namespace1\": {\n        \"key1\": {\n          \"source\": \"Hello\",\n          \"target\": \"Hallo\"\n        },\n        \"key2\": {\n          \"source\": \"An application to manipulate and process XLIFF documents\",\n          \"target\": \"Eine Applikation um XLIFF Dokumente zu manipulieren und verarbeiten\"\n        },\n        \"key.nested\": {\n          \"source\": \"XLIFF Data Manager\",\n          \"target\": \"XLIFF Daten Manager\"\n        }\n      }\n    },\n    \"sourceLanguage\": \"en-US\",\n    \"targetLanguage\": \"de-CH\"\n  }\n\n  const xliff12ToJs = require('xliff/xliff12ToJs');\n  xliff12ToJs(xliff, (err, res) => {\n    // res is like js\n  });\n\n  const jsToXliff12 = require('xliff/jsToXliff12');\n  jsToXliff12(js, (err, res) => {\n    // res is like xliff\n  });\n\n  const createxliff12 = require('xliff/createxliff12');\n  createxliff12(\n    js.sourceLanguage,\n    js.targetLanguage,\n    {\n      \"key1\": \"Hello\",\n      \"key2\": \"An application to manipulate and process XLIFF documents\",\n      \"key.nested\": \"XLIFF Data Manager\"\n    },\n    {\n      \"key1\": \"Hallo\",\n      \"key2\": \"Eine Applikation um XLIFF Dokumente zu manipulieren und verarbeiten\",\n      \"key.nested\": \"XLIFF Daten Manager\"\n    },\n    'namespace1',\n    (err, res) => {\n    // res is like xliff\n  });\n\n\n```\n\n### Using Inline Elements\n\nXLIFF 1.2 and 2.x support the use of a set of XML elements within `source` and `target` declarations. In general these \"inline\" tags exist to specify special elements within translation strings. For example, in XLIFF 1.2 the `<ph>..</ph>` element is used to define a \"placeholder\" such as for a variable value that is substituted at runtime, e.g.:\n\n- String: \"Hello there, {fullName}\"\n- XLIFF 1.2: `<source>Hello there, <ph>{fullName}</ph></source>`\n\nIn the standard case described previously, the `source` and `target` values are string instances. A `source` or `target` value can also be defined as an Array instance.\n\n```\n// Simple value:\n\"source\": \"Hello there\"\n// Value with multiple child elements:\n\"source\": [\"Hello \", \"there\"]\n```\n(Note that in this example there's no benefit from splitting the string into two strings wrapped in an array.)\n\nWhen the `source` and `target` values are Array instances, the elements of the Array contain strings (representing plain text) or objects (representing XLIFF inline elements). The structure for those objects is described next.\n\n#### Inline element object structure\n\nAn object representing an inline element has the following structure:\n\n```\n{\n  [<Element Type>]: {\n    \"id\": \"<Value>\",\n    \"contents\": \"<Element Contents>\",\n    \"<Other Property 1>\": \"<Other Property 1 Value>\",\n    ...\n    \"<Other Property N>\": \"<Other Property N Value>\"\n  }\n}\n```\nThe parts are:\n- `<Element Type>`: A string (used as a property name) indicating the element type.\n- `id` property: The value of the XLIFF element's `id` attribute\n- `contents` property: The contents of the XLIFF element, if supported. This value can be a string or array and is treated like the `source`/`target` values.\n- All other properties: Map directly to attributes of the XLIFF element tag\n\nHere's a real-world example:\n```\n{\n  \"Span\": {\n    \"id\": \"dataType\",\n    \"contents\": \"{dataType}\",\n    \"ctype\": \"x-python-brace-param\"\n  }\n}\n```\nThis maps to the following XLIFF inline element structure:\n```\n<ph id=\"dataType\" ctype=\"x-python-brace-param\">{dataType}</ph>\n```\n\n#### Full inline element example\n\nThe following code shows a full object structure for one type of XLIFF inline element (Generic span), and the corresponding XLIFF 1.2 and XLIFF 2.0 that it produces. For other examples of different element types, see [the inline element test fixtures](./test/fixtures/inline-elements)\n\n##### Strings\n```\nkey1:\nsource: \"Hello {name}\"\ntarget: \"Hallo {name}\"\n\nkey2:\nsource: \"An application to manipulate and process {doctype} documents.\"\ntarget: \"Eine Applikation um {doctype} Dokumente zu manipulieren und verarbeiten\"\n```\n\n##### JSON\n```\n{\n  \"resources\": {\n    \"namespace1\": {\n      \"key1\": {\n        \"source\": [\n          \"Hello \",\n          {\n            \"GenericSpan\": {\n              \"id\": \"name\",\n              \"ctype\": \"x-python-brace-param\",\n              \"contents\": \"{name}\"\n            }\n          }\n        ],\n        \"target\": [\n          \"Hallo \",\n          {\n            \"GenericSpan\": {\n              \"id\": \"name\",\n              \"ctype\": \"x-python-brace-param\",\n              \"contents\": \"{name}\"\n            }\n          }\n        ]\n      },\n      \"key2\": {\n        \"source\": [\n          \"An application to manipulate and process \",\n          {\n            \"GenericSpan\": {\n              \"id\": \"doctype\",\n              \"ctype\": \"x-python-brace-param\",\n              \"contents\": \"{doctype}\"\n            }\n          },\n          \" documents\"\n        ],\n        \"target\": [\n          \"Eine Applikation um \",\n          {\n            \"GenericSpan\": {\n              \"id\": \"doctype\",\n              \"ctype\": \"x-python-brace-param\",\n              \"contents\": \"{doctype}\"\n            }\n          },\n          \" Dokumente zu manipulieren und verarbeiten\"\n        ]\n      }\n    }\n  },\n  \"sourceLanguage\": \"en-US\",\n  \"targetLanguage\": \"de-CH\"\n}\n```\n\n##### XLIFF 1.2\n```\n<xliff 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\" xmlns=\"urn:oasis:names:tc:xliff:document:1.2\" version=\"1.2\">\n  <file original=\"namespace1\" datatype=\"plaintext\" source-language=\"en-US\" target-language=\"de-CH\">\n    <body>\n      <trans-unit id=\"key1\">\n        <source>Hello \n          <g id=\"name\" ctype=\"x-python-brace-param\">{name}</g>\n        </source>\n        <target>Hallo \n          <g id=\"name\" ctype=\"x-python-brace-param\">{name}</g>\n        </target>\n      </trans-unit>\n      <trans-unit id=\"key2\">\n        <source>An application to manipulate and process \n          <g id=\"doctype\" ctype=\"x-python-brace-param\">{doctype}</g> documents\n        </source>\n        <target>Eine Applikation um \n          <g id=\"doctype\" ctype=\"x-python-brace-param\">{doctype}</g> Dokumente zu manipulieren und verarbeiten\n        </target>\n      </trans-unit>\n    </body>\n  </file>\n</xliff>\n```\n\n##### XLIFF 2.0\n```\n<xliff xmlns=\"urn:oasis:names:tc:xliff:document:2.0\" version=\"2.0\" srcLang=\"en-US\" trgLang=\"de-CH\">\n  <file id=\"namespace1\">\n    <unit id=\"key1\">\n      <segment>\n        <source>Hello \n          <pc id=\"name\" ctype=\"x-python-brace-param\">{name}</pc>\n        </source>\n        <target>Hallo \n          <pc id=\"name\" ctype=\"x-python-brace-param\">{name}</pc>\n        </target>\n      </segment>\n    </unit>\n    <unit id=\"key2\">\n      <segment>\n        <source>An application to manipulate and process \n          <pc id=\"doctype\" ctype=\"x-python-brace-param\">{doctype}</pc> documents\n        </source>\n        <target>Eine Applikation um \n          <pc id=\"doctype\" ctype=\"x-python-brace-param\">{doctype}</pc> Dokumente zu manipulieren und verarbeiten\n        </target>\n      </segment>\n    </unit>\n  </file>\n</xliff>\n```\n\n#### Supported inline element types\n\nXLIFF 1.2 and XLIFF 2.x define different sets of inline elements. However, the underlying semantics of many of the elements are the same and they can be mapped to each other. The supported element types are:\n\n| Element type | Use Case | Representation (1.2) | Representation (2.0) |\n| ------------ | -------- | -------------------- | -------------------- |\n| **Generic** |\n| Standalone | Standalone code | `<x/>` | `<ph/>` | \n| GenericSpan | Well-formed spanning code | `<g></g>` | `<pc></pc>` |\n| GenericSpanStart | Start marker of spanning code | `<bx/>` | `<sc/>` |\n| GenericSpanEnd | End marker of spanning code | `<ex/>` | `<ec/>` |\n| **Native code** (same as generic for 2.0) | |  |\n| Span | Well-formed spanning code | `<ph></ph>` | `<pc></pc>` |\n| SpanStart | Start marker of spanning code | `<bpt></bpt>` | `<sc/>` |\n| SpanEnd | End marker of spanning code | `<ept></ept>` | `<ec/>` |\n\n  Note that there are additional inline elements defined in the XLIFF specifications that are not supported by this library, and are not listed here.\n\nThese types are defined as constants in [inline-elements/ElementTypes.js](./inline-elements/ElementTypes.js)\n\nAlthough both XLIFF versions define Generic element types, only XLIFF 1.2 defines Native element types. This library uses a \"superset\" approach to allow for compatibility between its data model and the different XLIFF versions. For example, an object representation of an XLIFF value that includes a `Span` (Native spanning code) is converted to a `<pc>..</pc>` element in XLIFF 2.0, even though XLIFF 2.0 doesn't technically support Native elements.\n\nThe rules for mapping between element types are as follows:\n\nJS -> XLIFF 1.2\n  Elements are written as their corresponding types\n\nJS -> XLIFF 2.0\n  Elements are written as their corresponding types. Native/generic types are mapped to the same XLIFF element type\n\nXLIFF 1.2 -> JS\n  Elements are read as their corresponding types\n\nXLIFF 2.0 -> JS\n  Elements are read as their corresponding (non-generic) types\n\nAs a result, you should be able to have \"roundtrip\" support for converting between JavaScript and XLIFF. The only exception is if an XLIFF 1.2 value is converted to JavaScript, then to XLIFF 2, then back to JavaScript, then to XLIFF 1.2. In that case the Native inline elements will be converted to XLIFF 1.2 Generic elements.\n\n#### Helpers for creating inline element objects\n\nIf you need to create your own inline element objects to construct a `source` or `target` array, you can use the `[makeInlineElement](./inline-elements/makeInlineElement.js)` function.\n\nFor example, suppose you have this string:\n\n> \"Hello {name}\"\n\nYou want to use it as a `source` value containing two parts -- the string \"Hello \" and a Generic Span element containing the placeholder variable \"{name}\", so that the end result (in XLIFF 1.2) should look like this:\n\n```\n<source>Hello \n  <g id=\"name\" ctype=\"x-python-brace-param\">{name}</g>\n</source>\n```\n\nYou can create this structure using the `makeInlineElement()` function with the following code:\n\n```\n// import or require makeInlineElements and ElementTypes\n// signature: makeInlineElement(type, id, attributes, contents)\nvar attributesObj = { ctype: 'x-python-brace-param' };\nvar inlineElementObj = makeInlineElement(ElementTypes.GenericSpan, 'name', attributesObj, '{name}');\n\nvar source = [ 'Hello ', inlineElementObj ];\n```\n","readmeFilename":"README.md"}