Comparing version 0.9.1 to 1.0.0
module.exports = { | ||
xliff2js: require('./xliff2js'), | ||
xliff12ToJs: require('./xliff12ToJs'), | ||
js2xliff: require('./js2xliff'), | ||
jsToXliff12: require('./jsToXliff12'), | ||
targetOfjs: require('./targetOfjs'), | ||
@@ -5,0 +7,0 @@ sourceOfjs: require('./sourceOfjs'), |
{ | ||
"name": "xliff", | ||
"version": "0.9.1", | ||
"version": "1.0.0", | ||
"description": "xliff2js and js2xliff converter xliff utils", | ||
"main": "index.js", | ||
"engines": { | ||
"node": ">=4.0.0" | ||
}, | ||
"dependencies": { | ||
"xml2js": "0.4.16" | ||
"xml2js": "0.4.17" | ||
}, | ||
"devDependencies": { | ||
"eslint": "^2.12.0", | ||
"eslint": "^3.18.0", | ||
"expect.js": "^0.3.1", | ||
"mocha": "^2.5.3" | ||
"mocha": "^3.2.0" | ||
}, | ||
@@ -14,0 +17,0 @@ "scripts": { |
@@ -27,2 +27,4 @@ [![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) | ||
##### XLIFF 2.0 | ||
```js | ||
@@ -142,1 +144,58 @@ | ||
``` | ||
##### XLIFF 1.2 | ||
```js | ||
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 = require('xliff/xliff12ToJs'); | ||
xliff12ToJs(xliff, (err, res) => { | ||
// res is like js | ||
}); | ||
const jsToXliff12 = require('xliff/jsToXliff12'); | ||
jsToXliff12(js, (err, res) => { | ||
// res is like xliff | ||
}); | ||
``` |
@@ -8,2 +8,3 @@ const fs = require('fs'); | ||
xliff: fs.readFileSync(path.join(__dirname, 'example.xliff')).toString().replace(/\n$/, ''), | ||
xliff12: fs.readFileSync(path.join(__dirname, 'example12.xliff')).toString().replace(/\n$/, ''), | ||
js_source: require('./example_source.json'), | ||
@@ -15,2 +16,3 @@ js_target: require('./example_target.json') | ||
xliff: fs.readFileSync(path.join(__dirname, 'example_multi.xliff')).toString().replace(/\n$/, ''), | ||
xliff12: fs.readFileSync(path.join(__dirname, 'example_multi12.xliff')).toString().replace(/\n$/, ''), | ||
js_source: require('./example_multi_source.json'), | ||
@@ -17,0 +19,0 @@ js_target: require('./example_multi_target.json') |
@@ -21,2 +21,10 @@ const expect = require('expect.js'); | ||
test('xliff12ToJs', (fn) => (done) => { | ||
fn(fixtures.example.xliff12, (err, res) => { | ||
expect(err).not.to.be.ok(); | ||
expect(res).to.eql(fixtures.example.js); | ||
done(); | ||
}); | ||
}); | ||
test('js2xliff', (fn) => (done) => { | ||
@@ -86,2 +94,10 @@ fn(fixtures.example.js, (err, res) => { | ||
test('xliff12ToJs', (fn) => (done) => { | ||
fn(fixtures.example_multi.xliff12, (err, res) => { | ||
expect(err).not.to.be.ok(); | ||
expect(res).to.eql(fixtures.example_multi.js); | ||
done(); | ||
}); | ||
}); | ||
test('js2xliff', (fn) => (done) => { | ||
@@ -88,0 +104,0 @@ fn(fixtures.example_multi.js, (err, res) => { |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
25046
28
489
1
200
+ Addedxml2js@0.4.17(transitive)
- Removedxml2js@0.4.16(transitive)
Updatedxml2js@0.4.17