New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

ngx-i18nsupport

Package Overview
Dependencies
Maintainers
1
Versions
41
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ngx-i18nsupport - npm Package Compare versions

Comparing version 0.2.3 to 0.3.0

7

Changelog.md

@@ -0,1 +1,8 @@

<a name="0.3.0"></a>
# [0.3.0](https://github.com/martinroob/ngx-i18nsupport/compare/v0.2.3...v0.3.0) (2017-04-24)
### Features
* **xliffmerge:** Added useSourceAsTargetOption, allows empty translations if set to false.
<a name="0.2.1"></a>

@@ -2,0 +9,0 @@ # [0.2.1](https://github.com/martinroob/ngx-i18nsupport/compare/v0.2.0...v0.2.1) (2017-03-27)

75

dist/common/command-output.js

@@ -13,4 +13,4 @@ /**

Object.defineProperty(exports, "__esModule", { value: true });
var chalk = require("chalk");
var util = require("util");
const chalk = require("chalk");
const util = require("util");
var LogLevel;

@@ -23,4 +23,4 @@ (function (LogLevel) {

})(LogLevel || (LogLevel = {}));
var CommandOutput = (function () {
function CommandOutput(stdout) {
class CommandOutput {
constructor(stdout) {
this._quiet = false;

@@ -35,8 +35,8 @@ this._verbose = false;

}
CommandOutput.prototype.setVerbose = function () {
setVerbose() {
this._verbose = true;
};
CommandOutput.prototype.setQuiet = function () {
}
setQuiet() {
this._quiet = true;
};
}
/**

@@ -46,5 +46,5 @@ * Test, wether verbose is enabled.

*/
CommandOutput.prototype.verbose = function () {
verbose() {
return this._verbose;
};
}
/**

@@ -54,38 +54,22 @@ * Test, wether queit is enabled.

*/
CommandOutput.prototype.quiet = function () {
quiet() {
return this._quiet;
};
CommandOutput.prototype.error = function (msg) {
var params = [];
for (var _i = 1; _i < arguments.length; _i++) {
params[_i - 1] = arguments[_i];
}
}
error(msg, ...params) {
this.log(LogLevel.ERROR, msg, params);
};
CommandOutput.prototype.warn = function (msg) {
var params = [];
for (var _i = 1; _i < arguments.length; _i++) {
params[_i - 1] = arguments[_i];
}
}
warn(msg, ...params) {
this.log(LogLevel.WARN, msg, params);
};
CommandOutput.prototype.info = function (msg) {
var params = [];
for (var _i = 1; _i < arguments.length; _i++) {
params[_i - 1] = arguments[_i];
}
}
info(msg, ...params) {
this.log(LogLevel.INFO, msg, params);
};
CommandOutput.prototype.debug = function (msg) {
var params = [];
for (var _i = 1; _i < arguments.length; _i++) {
params[_i - 1] = arguments[_i];
}
}
debug(msg, ...params) {
this.log(LogLevel.DEBUG, msg, params);
};
CommandOutput.prototype.log = function (level, msg, params) {
}
log(level, msg, params) {
if (!this.isOutputEnabled(level)) {
return;
}
var coloredMessage;
let coloredMessage;
switch (level) {

@@ -102,7 +86,7 @@ case LogLevel.ERROR:

}
var outMsg = util.format.apply(util, [coloredMessage].concat(params));
let outMsg = util.format(coloredMessage, ...params);
this.outputStream.write(outMsg + '\n');
};
CommandOutput.prototype.isOutputEnabled = function (level) {
var quietEnabled, verboseEnabled;
}
isOutputEnabled(level) {
let quietEnabled, verboseEnabled;
if (this._quiet && this._verbose) {

@@ -128,6 +112,5 @@ quietEnabled = false;

}
};
return CommandOutput;
}());
}
}
exports.CommandOutput = CommandOutput;
//# sourceMappingURL=s:/experimente/ngx-i18nsupport/src/common/command-output.js.map
//# sourceMappingURL=S:/experimente/ngx-i18nsupport/src/common/command-output.js.map
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var fs = require("fs");
const fs = require("fs");
/**

@@ -9,5 +9,3 @@ * Created by martin on 17.02.2017.

*/
var FileUtil = (function () {
function FileUtil() {
}
class FileUtil {
/**

@@ -18,5 +16,5 @@ * Check for existence.

*/
FileUtil.exists = function (filename) {
static exists(filename) {
return fs.existsSync(filename);
};
}
/**

@@ -28,5 +26,5 @@ * Read a file.

*/
FileUtil.read = function (filename, encoding) {
static read(filename, encoding) {
return fs.readFileSync(filename, encoding);
};
}
/**

@@ -38,12 +36,12 @@ * Write a file with given content.

*/
FileUtil.replaceContent = function (filename, newContent, encoding) {
static replaceContent(filename, newContent, encoding) {
fs.writeFileSync(filename, newContent, { encoding: encoding });
};
FileUtil.copy = function (srcFile, destFile) {
var BUF_LENGTH = 64 * 1024;
var buff = new Buffer(BUF_LENGTH);
var fdr = fs.openSync(srcFile, 'r');
var fdw = fs.openSync(destFile, 'w');
var bytesRead = 1;
var pos = 0;
}
static copy(srcFile, destFile) {
let BUF_LENGTH = 64 * 1024;
let buff = new Buffer(BUF_LENGTH);
let fdr = fs.openSync(srcFile, 'r');
let fdw = fs.openSync(destFile, 'w');
let bytesRead = 1;
let pos = 0;
while (bytesRead > 0) {

@@ -56,3 +54,3 @@ bytesRead = fs.readSync(fdr, buff, 0, BUF_LENGTH, pos);

fs.closeSync(fdw);
};
}
/**

@@ -62,3 +60,3 @@ * Delete the folder and all of its content (rm -rf).

*/
FileUtil.deleteFolderRecursive = function (path) {
static deleteFolderRecursive(path) {
var files = [];

@@ -78,3 +76,3 @@ if (fs.existsSync(path)) {

}
};
}
;

@@ -86,3 +84,3 @@ /**

*/
FileUtil.deleteFolderContentRecursive = function (path) {
static deleteFolderContentRecursive(path) {
var files = [];

@@ -101,7 +99,6 @@ if (fs.existsSync(path)) {

}
};
}
;
return FileUtil;
}());
}
exports.FileUtil = FileUtil;
//# sourceMappingURL=s:/experimente/ngx-i18nsupport/src/common/file-util.js.map
//# sourceMappingURL=S:/experimente/ngx-i18nsupport/src/common/file-util.js.map
"use strict";
var __extends = (this && this.__extends) || (function () {
var extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
Object.defineProperty(exports, "__esModule", { value: true });
var stream_1 = require("stream");
var util_1 = require("util");
const stream_1 = require("stream");
const util_1 = require("util");
/**

@@ -21,11 +11,9 @@ * Created by martin on 20.02.2017.

*/
var WriterToString = (function (_super) {
__extends(WriterToString, _super);
function WriterToString() {
var _this = _super.call(this) || this;
_this.resultString = '';
return _this;
class WriterToString extends stream_1.Writable {
constructor() {
super();
this.resultString = '';
}
WriterToString.prototype._write = function (chunk, encoding, callback) {
var chunkString;
_write(chunk, encoding, callback) {
let chunkString;
if (util_1.isString(chunk)) {

@@ -42,3 +30,3 @@ chunkString = chunk;

callback();
};
}
/**

@@ -48,8 +36,7 @@ * Returns a string of everything, that was written to the stream so far.

*/
WriterToString.prototype.writtenData = function () {
writtenData() {
return this.resultString;
};
return WriterToString;
}(stream_1.Writable));
}
}
exports.WriterToString = WriterToString;
//# sourceMappingURL=s:/experimente/ngx-i18nsupport/src/common/writer-to-string.js.map
//# sourceMappingURL=S:/experimente/ngx-i18nsupport/src/common/writer-to-string.js.map

@@ -7,2 +7,2 @@ /**

Object.defineProperty(exports, "__esModule", { value: true });
//# sourceMappingURL=s:/experimente/ngx-i18nsupport/src/xliffmerge/i-xliff-merge-options.js.map
//# sourceMappingURL=S:/experimente/ngx-i18nsupport/src/xliffmerge/i-xliff-merge-options.js.map
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var xliff_merge_1 = require("./xliff-merge");
const xliff_merge_1 = require("./xliff-merge");
/**

@@ -9,2 +9,2 @@ * Created by martin on 15.02.2017.

xliff_merge_1.XliffMerge.main(process.argv);
//# sourceMappingURL=s:/experimente/ngx-i18nsupport/src/xliffmerge/main.js.map
//# sourceMappingURL=S:/experimente/ngx-i18nsupport/src/xliffmerge/main.js.map
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var file_util_1 = require("../common/file-util");
var util_1 = require("util");
var NgxTranslateExtractor = (function () {
function NgxTranslateExtractor(messagesFile) {
const file_util_1 = require("../common/file-util");
const util_1 = require("util");
class NgxTranslateExtractor {
constructor(messagesFile) {
this.messagesFile = messagesFile;
}
NgxTranslateExtractor.extract = function (messagesFile, outputFile) {
static extract(messagesFile, outputFile) {
new NgxTranslateExtractor(messagesFile).extractTo(outputFile);
};
}
/**

@@ -16,6 +16,6 @@ * Extact messages and write them to a file.

*/
NgxTranslateExtractor.prototype.extractTo = function (outputFile) {
var translations = this.toNgxTranslations(this.extract());
extractTo(outputFile) {
let translations = this.toNgxTranslations(this.extract());
file_util_1.FileUtil.replaceContent(outputFile, JSON.stringify(translations, null, 4), 'UTF-8');
};
}
/**

@@ -25,10 +25,9 @@ * Extract messages and convert them to ngx translations.

*/
NgxTranslateExtractor.prototype.extract = function () {
var _this = this;
var result = [];
this.messagesFile.forEachTransUnit(function (tu) {
var description = tu.description();
var id = tu.meaning();
extract() {
let result = [];
this.messagesFile.forEachTransUnit((tu) => {
let description = tu.description();
let id = tu.meaning();
if (description && description === 'ngx-translate') {
var messagetext = _this.toTranslateString(tu.targetContentNormalized());
let messagetext = this.toTranslateString(tu.targetContentNormalized());
result.push({ id: id, message: messagetext });

@@ -38,6 +37,6 @@ }

return result;
};
NgxTranslateExtractor.prototype.toTranslateString = function (contentFromTU) {
}
toTranslateString(contentFromTU) {
return contentFromTU;
};
}
/**

@@ -47,10 +46,9 @@ * Convert list of relevant TUs to ngx translations object.

*/
NgxTranslateExtractor.prototype.toNgxTranslations = function (msgList) {
var _this = this;
var translationObject = {};
msgList.forEach(function (msg) {
_this.putInTranslationObject(translationObject, msg);
toNgxTranslations(msgList) {
let translationObject = {};
msgList.forEach((msg) => {
this.putInTranslationObject(translationObject, msg);
});
return translationObject;
};
}
/**

@@ -66,6 +64,6 @@ * Put a new messages into the translation data object.

*/
NgxTranslateExtractor.prototype.putInTranslationObject = function (translationObject, msg) {
var firstPartOfId;
var restOfId;
var indexOfDot = msg.id.indexOf('.');
putInTranslationObject(translationObject, msg) {
let firstPartOfId;
let restOfId;
let indexOfDot = msg.id.indexOf('.');
if (indexOfDot == 0 || indexOfDot == (msg.id.length - 1)) {

@@ -82,3 +80,3 @@ throw new Error('bad nxg-translate id "' + msg.id + '"');

}
var object = translationObject[firstPartOfId];
let object = translationObject[firstPartOfId];
if (util_1.isNullOrUndefined(object)) {

@@ -98,6 +96,5 @@ if (restOfId === '') {

this.putInTranslationObject(object, { id: restOfId, message: msg.message });
};
return NgxTranslateExtractor;
}());
}
}
exports.NgxTranslateExtractor = NgxTranslateExtractor;
//# sourceMappingURL=s:/experimente/ngx-i18nsupport/src/xliffmerge/ngx-translate-extractor.js.map
//# sourceMappingURL=S:/experimente/ngx-i18nsupport/src/xliffmerge/ngx-translate-extractor.js.map
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var xml_reader_1 = require("./xml-reader");
var xliff_file_1 = require("./xliff-file");
var xmb_file_1 = require("./xmb-file");
var util_1 = require("util");
var file_util_1 = require("../common/file-util");
/**
* Created by roobm on 21.03.2017.
*/
const ngx_i18nsupport_lib_1 = require("ngx-i18nsupport-lib");
const file_util_1 = require("../common/file-util");
const xml_reader_1 = require("./xml-reader");
/**
* Helper class to read translation files depending on format.
*/
var TranslationMessagesFileReader = (function () {
function TranslationMessagesFileReader() {
class TranslationMessagesFileReader {
/**
* Read file function, result depends on format, either XliffFile or XmbFile.
* @param format
* @param path
* @param encoding
* @return {XliffFile}
*/
static fromFile(i18nFormat, path, encoding, optionalMasterFilePath) {
let xmlContent = xml_reader_1.XmlReader.readXmlFileContent(path, encoding);
let optionalMaster = TranslationMessagesFileReader.masterFileContent(optionalMasterFilePath, encoding);
return ngx_i18nsupport_lib_1.TranslationMessagesFileFactory.fromFileContent(i18nFormat, xmlContent.content, path, xmlContent.encoding, optionalMaster);
}

@@ -21,14 +32,26 @@ /**

*/
TranslationMessagesFileReader.fromFile = function (i18nFormat, path, encoding) {
var xmlContent = xml_reader_1.XmlReader.readXmlFileContent(path, encoding);
if (i18nFormat === 'xlf') {
return new xliff_file_1.XliffFile(xmlContent.content, path, xmlContent.encoding);
static fromUnknownFormatFile(path, encoding, optionalMasterFilePath) {
let xmlContent = xml_reader_1.XmlReader.readXmlFileContent(path, encoding);
let optionalMaster = TranslationMessagesFileReader.masterFileContent(optionalMasterFilePath, encoding);
return ngx_i18nsupport_lib_1.TranslationMessagesFileFactory.fromUnknownFormatFileContent(xmlContent.content, path, xmlContent.encoding, optionalMaster);
}
/**
* Read master xmb file
* @param optionalMasterFilePath
* @param encoding
* @return {any} content and encoding of file
*/
static masterFileContent(optionalMasterFilePath, encoding) {
if (optionalMasterFilePath) {
let masterXmlContent = xml_reader_1.XmlReader.readXmlFileContent(optionalMasterFilePath, encoding);
return {
xmlContent: masterXmlContent.content,
path: optionalMasterFilePath,
encoding: masterXmlContent.encoding
};
}
if (i18nFormat === 'xmb') {
return new xmb_file_1.XmbFile(xmlContent.content, path, xmlContent.encoding);
}
else {
throw new Error(util_1.format('oops, unsupported format "%s"', i18nFormat));
return null;
}
};
}
/**

@@ -38,8 +61,7 @@ * Save edited file.

*/
TranslationMessagesFileReader.save = function (messagesFile) {
static save(messagesFile) {
file_util_1.FileUtil.replaceContent(messagesFile.filename(), messagesFile.editedContent(), messagesFile.encoding());
};
return TranslationMessagesFileReader;
}());
}
}
exports.TranslationMessagesFileReader = TranslationMessagesFileReader;
//# sourceMappingURL=s:/experimente/ngx-i18nsupport/src/xliffmerge/translation-messages-file-reader.js.map
//# sourceMappingURL=S:/experimente/ngx-i18nsupport/src/xliffmerge/translation-messages-file-reader.js.map

@@ -6,5 +6,5 @@ "use strict";

*/
var path = require("path");
var pkg = require(path.resolve(__dirname, '..', '..', 'package.json'));
const path = require("path");
const pkg = require(path.resolve(__dirname, '..', '..', 'package.json'));
exports.VERSION = (pkg ? pkg.version : 'unknown');
//# sourceMappingURL=s:/experimente/ngx-i18nsupport/src/xliffmerge/version.js.map
//# sourceMappingURL=S:/experimente/ngx-i18nsupport/src/xliffmerge/version.js.map

@@ -5,24 +5,11 @@ /**

"use strict";
var __extends = (this && this.__extends) || (function () {
var extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
Object.defineProperty(exports, "__esModule", { value: true });
var XliffMergeError = (function (_super) {
__extends(XliffMergeError, _super);
function XliffMergeError(msg) {
var _this = _super.call(this, msg) || this;
class XliffMergeError extends Error {
constructor(msg) {
super(msg);
// Set the prototype explicitly.
Object.setPrototypeOf(_this, XliffMergeError.prototype);
return _this;
Object.setPrototypeOf(this, XliffMergeError.prototype);
}
return XliffMergeError;
}(Error));
}
exports.XliffMergeError = XliffMergeError;
//# sourceMappingURL=s:/experimente/ngx-i18nsupport/src/xliffmerge/xliff-merge-error.js.map
//# sourceMappingURL=S:/experimente/ngx-i18nsupport/src/xliffmerge/xliff-merge-error.js.map

@@ -8,10 +8,6 @@ /**

Object.defineProperty(exports, "__esModule", { value: true });
var fs = require("fs");
var xliff_merge_error_1 = require("./xliff-merge-error");
var util_1 = require("util");
var XliffMergeParameters = (function () {
function XliffMergeParameters() {
this.errorsFound = [];
this.warningsFound = [];
}
const fs = require("fs");
const xliff_merge_error_1 = require("./xliff-merge-error");
const util_1 = require("util");
class XliffMergeParameters {
/**

@@ -23,7 +19,11 @@ * Create Parameters.

*/
XliffMergeParameters.createFromOptions = function (options, profileContent) {
var parameters = new XliffMergeParameters();
static createFromOptions(options, profileContent) {
let parameters = new XliffMergeParameters();
parameters.configure(options, profileContent);
return parameters;
};
}
constructor() {
this.errorsFound = [];
this.warningsFound = [];
}
/**

@@ -35,3 +35,3 @@ * Initialize me from the profile content.

*/
XliffMergeParameters.prototype.configure = function (options, profileContent) {
configure(options, profileContent) {
this.errorsFound = [];

@@ -42,3 +42,3 @@ this.warningsFound = [];

}
var validProfile = (!!profileContent);
let validProfile = (!!profileContent);
if (options.quiet) {

@@ -61,3 +61,3 @@ this._quiet = options.quiet;

}
};
}
/**

@@ -68,8 +68,8 @@ * Read profile.

*/
XliffMergeParameters.prototype.readProfile = function (options) {
var profilePath = options.profilePath;
readProfile(options) {
let profilePath = options.profilePath;
if (!profilePath) {
return {};
}
var content;
let content;
try {

@@ -82,10 +82,10 @@ content = fs.readFileSync(profilePath, 'UTF-8');

}
var profileContent = JSON.parse(content);
let profileContent = JSON.parse(content);
return profileContent;
};
XliffMergeParameters.prototype.initializeFromConfig = function (profileContent) {
}
initializeFromConfig(profileContent) {
if (!profileContent) {
return;
}
var profile = profileContent.xliffmergeOptions;
let profile = profileContent.xliffmergeOptions;
if (profile) {

@@ -134,3 +134,3 @@ if (!util_1.isNullOrUndefined(profile.quiet)) {

}
};
}
/**

@@ -140,4 +140,3 @@ * Check all Parameters, wether they are complete and consistent.

*/
XliffMergeParameters.prototype.checkParameters = function () {
var _this = this;
checkParameters() {
this.checkLanguageSyntax(this.defaultLanguage());

@@ -147,7 +146,7 @@ if (this.languages().length == 0) {

}
this.languages().forEach(function (lang) {
_this.checkLanguageSyntax(lang);
this.languages().forEach((lang) => {
this.checkLanguageSyntax(lang);
});
var stats;
var err;
let stats;
let err;
// srcDir should exists

@@ -184,3 +183,3 @@ try {

}
};
}
/**

@@ -192,18 +191,18 @@ * Check syntax of language.

*/
XliffMergeParameters.prototype.checkLanguageSyntax = function (lang) {
var pattern = /^[a-zA-Z]{1,8}(-[a-zA-Z0-9]{1,8})*$/;
checkLanguageSyntax(lang) {
let pattern = /^[a-zA-Z]{1,8}(-[a-zA-Z0-9]{1,8})*$/;
if (!pattern.test(lang)) {
this.errorsFound.push(new xliff_merge_error_1.XliffMergeError('language "' + lang + '" is not valid'));
}
};
XliffMergeParameters.prototype.verbose = function () {
}
verbose() {
return (util_1.isNullOrUndefined(this._verbose)) ? false : this._verbose;
};
XliffMergeParameters.prototype.quiet = function () {
}
quiet() {
return (util_1.isNullOrUndefined(this._quiet)) ? false : this._quiet;
};
}
/**
* Debug output all parameters to commandOutput.
*/
XliffMergeParameters.prototype.showAllParameters = function (commandOutput) {
showAllParameters(commandOutput) {
commandOutput.debug('xliffmerge Used Parameters:');

@@ -218,3 +217,3 @@ commandOutput.debug('defaultLanguage:\t"%s"', this.defaultLanguage());

commandOutput.debug('supportNgxTranslate:\t%s', this.supportNgxTranslate());
};
}
/**

@@ -224,5 +223,5 @@ * Default-Language, default en.

*/
XliffMergeParameters.prototype.defaultLanguage = function () {
defaultLanguage() {
return this._defaultLanguage ? this._defaultLanguage : 'en';
};
}
/**

@@ -232,5 +231,5 @@ * Liste der zu bearbeitenden Sprachen.

*/
XliffMergeParameters.prototype.languages = function () {
languages() {
return this._languages ? this._languages : [];
};
}
/**

@@ -240,5 +239,5 @@ * src directory, where the master xlif is located.

*/
XliffMergeParameters.prototype.srcDir = function () {
srcDir() {
return this._srcDir ? this._srcDir : '.';
};
}
/**

@@ -249,5 +248,5 @@ * The master xlif file (the one generated by ng-xi18n).

*/
XliffMergeParameters.prototype.i18nFile = function () {
i18nFile() {
return this.srcDir() + '/' + (this._i18nFile ? this._i18nFile : 'messages.' + this.i18nFormat());
};
}
/**

@@ -258,5 +257,5 @@ * Format of the master xlif file.

*/
XliffMergeParameters.prototype.i18nFormat = function () {
i18nFormat() {
return (this._i18nFormat ? this._i18nFormat : 'xlf');
};
}
/**

@@ -267,5 +266,5 @@ * potentially to be generated I18n-File with the translations for one language.

*/
XliffMergeParameters.prototype.generatedI18nFile = function (lang) {
generatedI18nFile(lang) {
return this.genDir() + '/' + 'messages.' + lang + '.' + this.i18nFormat();
};
}
/**

@@ -276,5 +275,5 @@ * potentially to be generated translate-File for ngx-translate with the translations for one language.

*/
XliffMergeParameters.prototype.generatedNgxTranslateFile = function (lang) {
generatedNgxTranslateFile(lang) {
return this.genDir() + '/' + 'messages.' + lang + '.' + 'json';
};
}
/**

@@ -284,5 +283,5 @@ * The encoding used to write new XLIFF-files.

*/
XliffMergeParameters.prototype.encoding = function () {
encoding() {
return this._encoding ? this._encoding : 'UTF-8';
};
}
/**

@@ -292,14 +291,13 @@ * Output-Directory, where the output is written to.

*/
XliffMergeParameters.prototype.genDir = function () {
genDir() {
return this._genDir ? this._genDir : this.srcDir();
};
XliffMergeParameters.prototype.removeUnusedIds = function () {
}
removeUnusedIds() {
return (util_1.isNullOrUndefined(this._removeUnusedIds)) ? true : this._removeUnusedIds;
};
XliffMergeParameters.prototype.supportNgxTranslate = function () {
}
supportNgxTranslate() {
return (util_1.isNullOrUndefined(this._supportNgxTranslate)) ? false : this._supportNgxTranslate;
};
return XliffMergeParameters;
}());
}
}
exports.XliffMergeParameters = XliffMergeParameters;
//# sourceMappingURL=s:/experimente/ngx-i18nsupport/src/xliffmerge/xliff-merge-parameters.js.map
//# sourceMappingURL=S:/experimente/ngx-i18nsupport/src/xliffmerge/xliff-merge-parameters.js.map
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var program = require("commander");
var command_output_1 = require("../common/command-output");
var xliff_merge_parameters_1 = require("./xliff-merge-parameters");
var xliff_merge_error_1 = require("./xliff-merge-error");
var file_util_1 = require("../common/file-util");
var version_1 = require("./version");
var util_1 = require("util");
var ngx_translate_extractor_1 = require("./ngx-translate-extractor");
var translation_messages_file_reader_1 = require("./translation-messages-file-reader");
const program = require("commander");
const command_output_1 = require("../common/command-output");
const xliff_merge_parameters_1 = require("./xliff-merge-parameters");
const xliff_merge_error_1 = require("./xliff-merge-error");
const file_util_1 = require("../common/file-util");
const version_1 = require("./version");
const util_1 = require("util");
const ngx_translate_extractor_1 = require("./ngx-translate-extractor");
const translation_messages_file_reader_1 = require("./translation-messages-file-reader");
/**

@@ -17,15 +17,10 @@ * Created by martin on 17.02.2017.

*/
var XliffMerge = (function () {
function XliffMerge(commandOutput, options) {
this.commandOutput = commandOutput;
this.options = options;
this.parameters = null;
class XliffMerge {
static main(argv) {
let options = XliffMerge.parseArgs(argv);
let result = new XliffMerge(new command_output_1.CommandOutput(process.stdout), options).run();
process.exit(result);
}
XliffMerge.main = function (argv) {
var options = XliffMerge.parseArgs(argv);
var result = new XliffMerge(new command_output_1.CommandOutput(process.stdout), options).run();
process.exit(result);
};
XliffMerge.parseArgs = function (argv) {
var languages = null;
static parseArgs(argv) {
let languages = null;
delete program.verbose;

@@ -41,3 +36,3 @@ delete program.quiet;

.option('-q, --quiet', 'only show errors, nothing else')
.on('--help', function () {
.on('--help', () => {
console.log(' <language> has to be a valid language short string, e,g. "en", "de", "de-ch"');

@@ -49,7 +44,7 @@ console.log('');

})
.action(function (languageArray) {
.action((languageArray) => {
languages = languageArray;
})
.parse(argv);
var options = {
let options = {
languages: languages

@@ -67,3 +62,3 @@ };

return options;
};
}
/**

@@ -75,8 +70,13 @@ * For Tests, create instance with given profile

*/
XliffMerge.createFromOptions = function (commandOutput, options, profileContent) {
var instance = new XliffMerge(commandOutput, options);
static createFromOptions(commandOutput, options, profileContent) {
let instance = new XliffMerge(commandOutput, options);
instance.parameters = xliff_merge_parameters_1.XliffMergeParameters.createFromOptions(options, profileContent);
return instance;
};
XliffMerge.prototype.run = function () {
}
constructor(commandOutput, options) {
this.commandOutput = commandOutput;
this.options = options;
this.parameters = null;
}
run() {
try {

@@ -97,8 +97,7 @@ this.doRun();

}
};
}
/**
* Ausführen merge-Process.
*/
XliffMerge.prototype.doRun = function () {
var _this = this;
doRun() {
if (this.options && this.options.quiet) {

@@ -118,4 +117,3 @@ this.commandOutput.setQuiet();

if (this.parameters.errorsFound.length > 0) {
for (var _i = 0, _a = this.parameters.errorsFound; _i < _a.length; _i++) {
var err = _a[_i];
for (let err of this.parameters.errorsFound) {
this.commandOutput.error(err.message);

@@ -126,4 +124,3 @@ }

if (this.parameters.warningsFound.length > 0) {
for (var _b = 0, _c = this.parameters.warningsFound; _b < _c.length; _b++) {
var warn = _c[_b];
for (let warn of this.parameters.warningsFound) {
this.commandOutput.warn(warn);

@@ -133,6 +130,6 @@ }

this.readMaster();
this.parameters.languages().forEach(function (lang) {
_this.processLanguage(lang);
this.parameters.languages().forEach((lang) => {
this.processLanguage(lang);
});
};
}
/**

@@ -143,5 +140,5 @@ * Return the name of the generated file for given lang.

*/
XliffMerge.prototype.generatedI18nFile = function (lang) {
generatedI18nFile(lang) {
return this.parameters.generatedI18nFile(lang);
};
}
/**

@@ -152,13 +149,12 @@ * Return the name of the generated ngx-translation file for given lang.

*/
XliffMerge.prototype.generatedNgxTranslateFile = function (lang) {
generatedNgxTranslateFile(lang) {
return this.parameters.generatedNgxTranslateFile(lang);
};
XliffMerge.prototype.readMaster = function () {
var _this = this;
}
readMaster() {
this.master = translation_messages_file_reader_1.TranslationMessagesFileReader.fromFile(this.parameters.i18nFormat(), this.parameters.i18nFile(), this.parameters.encoding());
this.master.warnings().forEach(function (warning) {
_this.commandOutput.warn(warning);
this.master.warnings().forEach((warning) => {
this.commandOutput.warn(warning);
});
var count = this.master.numberOfTransUnits();
var missingIdCount = this.master.numberOfTransUnitsWithMissingId();
let count = this.master.numberOfTransUnits();
let missingIdCount = this.master.numberOfTransUnitsWithMissingId();
this.commandOutput.info('master contains %s trans-units', count);

@@ -168,3 +164,3 @@ if (missingIdCount > 0) {

}
var sourceLang = this.master.sourceLanguage();
let sourceLang = this.master.sourceLanguage();
if (sourceLang && sourceLang !== this.parameters.defaultLanguage()) {

@@ -176,6 +172,6 @@ this.commandOutput.warn('master says to have source-language="%s", should be "%s" (your defaultLanguage)', sourceLang, this.parameters.defaultLanguage());

}
};
XliffMerge.prototype.processLanguage = function (lang) {
}
processLanguage(lang) {
this.commandOutput.debug('processing language %s', lang);
var languageXliffFile = this.parameters.generatedI18nFile(lang);
let languageXliffFile = this.parameters.generatedI18nFile(lang);
if (!file_util_1.FileUtil.exists(languageXliffFile)) {

@@ -188,6 +184,6 @@ this.createUntranslatedXliff(lang, languageXliffFile);

if (this.parameters.supportNgxTranslate()) {
var languageSpecificMessagesFile = translation_messages_file_reader_1.TranslationMessagesFileReader.fromFile(this.parameters.i18nFormat(), languageXliffFile, this.parameters.encoding());
let languageSpecificMessagesFile = translation_messages_file_reader_1.TranslationMessagesFileReader.fromFile(this.parameters.i18nFormat(), languageXliffFile, this.parameters.encoding());
ngx_translate_extractor_1.NgxTranslateExtractor.extract(languageSpecificMessagesFile, this.parameters.generatedNgxTranslateFile(lang));
}
};
}
/**

@@ -199,11 +195,11 @@ * create a new file for the language, which contains no translations, but all keys.

*/
XliffMerge.prototype.createUntranslatedXliff = function (lang, languageXliffFilePath) {
createUntranslatedXliff(lang, languageXliffFilePath) {
// copy master ...
file_util_1.FileUtil.copy(this.parameters.i18nFile(), languageXliffFilePath);
// read copy and set target-language
var languageSpecificMessagesFile = translation_messages_file_reader_1.TranslationMessagesFileReader.fromFile(this.parameters.i18nFormat(), languageXliffFilePath, this.parameters.encoding());
let languageSpecificMessagesFile = translation_messages_file_reader_1.TranslationMessagesFileReader.fromFile(this.parameters.i18nFormat(), languageXliffFilePath, this.parameters.encoding());
languageSpecificMessagesFile.setTargetLanguage(lang);
// copy source to target
var isDefaultLang = (lang == this.parameters.defaultLanguage());
languageSpecificMessagesFile.forEachTransUnit(function (transUnit) {
let isDefaultLang = (lang == this.parameters.defaultLanguage());
languageSpecificMessagesFile.forEachTransUnit((transUnit) => {
languageSpecificMessagesFile.useSourceAsTarget(transUnit, isDefaultLang);

@@ -217,3 +213,3 @@ });

}
};
}
/**

@@ -224,10 +220,9 @@ * Merge all

*/
XliffMerge.prototype.mergeMasterTo = function (lang, languageXliffFilePath) {
var _this = this;
mergeMasterTo(lang, languageXliffFilePath) {
// read lang specific file
var languageSpecificMessagesFile = translation_messages_file_reader_1.TranslationMessagesFileReader.fromFile(this.parameters.i18nFormat(), languageXliffFilePath, this.parameters.encoding());
var isDefaultLang = (lang == this.parameters.defaultLanguage());
var newCount = 0;
this.master.forEachTransUnit(function (masterTransUnit) {
var transUnit = languageSpecificMessagesFile.transUnitWithId(masterTransUnit.id);
let languageSpecificMessagesFile = translation_messages_file_reader_1.TranslationMessagesFileReader.fromFile(this.parameters.i18nFormat(), languageXliffFilePath, this.parameters.encoding());
let isDefaultLang = (lang == this.parameters.defaultLanguage());
let newCount = 0;
this.master.forEachTransUnit((masterTransUnit) => {
let transUnit = languageSpecificMessagesFile.transUnitWithId(masterTransUnit.id);
if (!transUnit) {

@@ -244,7 +239,7 @@ // oops, no translation, must be a new key, so add it

// remove all elements that are no longer used
var removeCount = 0;
languageSpecificMessagesFile.forEachTransUnit(function (transUnit) {
var existsInMaster = !util_1.isNullOrUndefined(_this.master.transUnitWithId(transUnit.id));
let removeCount = 0;
languageSpecificMessagesFile.forEachTransUnit((transUnit) => {
let existsInMaster = !util_1.isNullOrUndefined(this.master.transUnitWithId(transUnit.id));
if (!existsInMaster) {
if (_this.parameters.removeUnusedIds()) {
if (this.parameters.removeUnusedIds()) {
languageSpecificMessagesFile.removeTransUnitWithId(transUnit.id);

@@ -274,6 +269,5 @@ }

}
};
return XliffMerge;
}());
}
}
exports.XliffMerge = XliffMerge;
//# sourceMappingURL=s:/experimente/ngx-i18nsupport/src/xliffmerge/xliff-merge.js.map
//# sourceMappingURL=S:/experimente/ngx-i18nsupport/src/xliffmerge/xliff-merge.js.map
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var fs = require("fs");
var xliff_merge_1 = require("./xliff-merge");
var command_output_1 = require("../common/command-output");
var writer_to_string_1 = require("../common/writer-to-string");
var file_util_1 = require("../common/file-util");
var translation_messages_file_reader_1 = require("./translation-messages-file-reader");
const fs = require("fs");
const xliff_merge_1 = require("./xliff-merge");
const command_output_1 = require("../common/command-output");
const writer_to_string_1 = require("../common/writer-to-string");
const file_util_1 = require("../common/file-util");
const translation_messages_file_reader_1 = require("./translation-messages-file-reader");
/**

@@ -13,3 +13,3 @@ * Created by martin on 18.02.2017.

*/
describe('XliffMerge test spec', function () {
describe('XliffMerge test spec', () => {
/**

@@ -21,5 +21,5 @@ * Workdir, not in git.

*/
var WORKDIR = 'test/work/';
var SRCDIR = 'test/testdata/i18n/';
var ENCODING = 'UTF-8';
let WORKDIR = 'test/work/';
let SRCDIR = 'test/testdata/i18n/';
let ENCODING = 'UTF-8';
/**

@@ -39,5 +39,12 @@ * Helper function to read Xliff from File

}
describe('test the tooling used in the tests', function () {
it('should write output to string (Test WriterToString)', function () {
var ws = new writer_to_string_1.WriterToString();
/**
* Helper function to read Xmb from 2 Files, the xmb and the master
* @type {string}
*/
function readXmbWithMaster(path, masterPath) {
return translation_messages_file_reader_1.TranslationMessagesFileReader.fromFile('xmb', path, ENCODING, masterPath);
}
describe('test the tooling used in the tests', () => {
it('should write output to string (Test WriterToString)', () => {
let ws = new writer_to_string_1.WriterToString();
ws.write('test test test\n');

@@ -48,17 +55,17 @@ ws.write('line 2');

});
describe('command line and configuration checks', function () {
it('should parse -v option', function () {
var options = xliff_merge_1.XliffMerge.parseArgs(['node', 'xliffmerge', '-v']);
describe('command line and configuration checks', () => {
it('should parse -v option', () => {
let options = xliff_merge_1.XliffMerge.parseArgs(['node', 'xliffmerge', '-v']);
expect(options.verbose).toBeTruthy();
expect(options.quiet).toBeFalsy();
});
it('should parse -q option', function () {
var options = xliff_merge_1.XliffMerge.parseArgs(['node', 'xliffmerge', '-q']);
it('should parse -q option', () => {
let options = xliff_merge_1.XliffMerge.parseArgs(['node', 'xliffmerge', '-q']);
expect(options.quiet).toBeTruthy();
expect(options.verbose).toBeFalsy();
});
it('should output version and used parameters when called with defaults and verbose flag', function (done) {
var ws = new writer_to_string_1.WriterToString();
var commandOut = new command_output_1.CommandOutput(ws);
var xliffMergeCmd = new xliff_merge_1.XliffMerge(commandOut, { verbose: true });
it('should output version and used parameters when called with defaults and verbose flag', (done) => {
let ws = new writer_to_string_1.WriterToString();
let commandOut = new command_output_1.CommandOutput(ws);
let xliffMergeCmd = new xliff_merge_1.XliffMerge(commandOut, { verbose: true });
xliffMergeCmd.run();

@@ -69,6 +76,6 @@ expect(ws.writtenData()).toContain('xliffmerge version');

});
it('should not output version and used parameters when called with defaults and both verbose and quiet flag', function (done) {
var ws = new writer_to_string_1.WriterToString();
var commandOut = new command_output_1.CommandOutput(ws);
var xliffMergeCmd = new xliff_merge_1.XliffMerge(commandOut, { verbose: true, quiet: true });
it('should not output version and used parameters when called with defaults and both verbose and quiet flag', (done) => {
let ws = new writer_to_string_1.WriterToString();
let commandOut = new command_output_1.CommandOutput(ws);
let xliffMergeCmd = new xliff_merge_1.XliffMerge(commandOut, { verbose: true, quiet: true });
xliffMergeCmd.run();

@@ -79,6 +86,6 @@ expect(ws.writtenData()).not.toContain('xliffmerge version');

});
it('should output an errror (no languages) when called with defaults', function (done) {
var ws = new writer_to_string_1.WriterToString();
var commandOut = new command_output_1.CommandOutput(ws);
var xliffMergeCmd = new xliff_merge_1.XliffMerge(commandOut, {});
it('should output an errror (no languages) when called with defaults', (done) => {
let ws = new writer_to_string_1.WriterToString();
let commandOut = new command_output_1.CommandOutput(ws);
let xliffMergeCmd = new xliff_merge_1.XliffMerge(commandOut, {});
xliffMergeCmd.run();

@@ -89,6 +96,6 @@ expect(ws.writtenData()).toContain('ERROR');

});
it('should output an errror (i18nfile) when called with defaults', function (done) {
var ws = new writer_to_string_1.WriterToString();
var commandOut = new command_output_1.CommandOutput(ws);
var xliffMergeCmd = new xliff_merge_1.XliffMerge(commandOut, { languages: ['de', 'en'] });
it('should output an errror (i18nfile) when called with defaults', (done) => {
let ws = new writer_to_string_1.WriterToString();
let commandOut = new command_output_1.CommandOutput(ws);
let xliffMergeCmd = new xliff_merge_1.XliffMerge(commandOut, { languages: ['de', 'en'] });
xliffMergeCmd.run();

@@ -99,6 +106,6 @@ expect(ws.writtenData()).toContain('ERROR');

});
it('should output an errror (could not read) when called with a non existing profile', function (done) {
var ws = new writer_to_string_1.WriterToString();
var commandOut = new command_output_1.CommandOutput(ws);
var xliffMergeCmd = new xliff_merge_1.XliffMerge(commandOut, { verbose: true, profilePath: 'lmaa' });
it('should output an errror (could not read) when called with a non existing profile', (done) => {
let ws = new writer_to_string_1.WriterToString();
let commandOut = new command_output_1.CommandOutput(ws);
let xliffMergeCmd = new xliff_merge_1.XliffMerge(commandOut, { verbose: true, profilePath: 'lmaa' });
xliffMergeCmd.run();

@@ -109,6 +116,6 @@ expect(ws.writtenData()).toContain('ERROR');

});
it('should read test config file', function (done) {
var ws = new writer_to_string_1.WriterToString();
var commandOut = new command_output_1.CommandOutput(ws);
var xliffMergeCmd = xliff_merge_1.XliffMerge.createFromOptions(commandOut, { profilePath: './test/testdata/xliffmergeconfig.json', verbose: true }, null);
it('should read test config file', (done) => {
let ws = new writer_to_string_1.WriterToString();
let commandOut = new command_output_1.CommandOutput(ws);
let xliffMergeCmd = xliff_merge_1.XliffMerge.createFromOptions(commandOut, { profilePath: './test/testdata/xliffmergeconfig.json', verbose: true }, null);
xliffMergeCmd.run();

@@ -118,6 +125,6 @@ expect(ws.writtenData()).toContain('languages: de,en');

});
it('should output an errror (srcDir not readable) when called with a non existing srcDir', function (done) {
var ws = new writer_to_string_1.WriterToString();
var commandOut = new command_output_1.CommandOutput(ws);
var profileContent = {
it('should output an errror (srcDir not readable) when called with a non existing srcDir', (done) => {
let ws = new writer_to_string_1.WriterToString();
let commandOut = new command_output_1.CommandOutput(ws);
let profileContent = {
xliffmergeOptions: {

@@ -127,3 +134,3 @@ srcDir: 'lmaa',

};
var xliffMergeCmd = xliff_merge_1.XliffMerge.createFromOptions(commandOut, { verbose: true }, profileContent);
let xliffMergeCmd = xliff_merge_1.XliffMerge.createFromOptions(commandOut, { verbose: true }, profileContent);
xliffMergeCmd.run();

@@ -134,6 +141,6 @@ expect(ws.writtenData()).toContain('ERROR');

});
it('should output an errror (genDir not existing) when called with a non existing genDir', function (done) {
var ws = new writer_to_string_1.WriterToString();
var commandOut = new command_output_1.CommandOutput(ws);
var profileContent = {
it('should output an errror (genDir not existing) when called with a non existing genDir', (done) => {
let ws = new writer_to_string_1.WriterToString();
let commandOut = new command_output_1.CommandOutput(ws);
let profileContent = {
xliffmergeOptions: {

@@ -143,3 +150,3 @@ genDir: 'lmaa',

};
var xliffMergeCmd = xliff_merge_1.XliffMerge.createFromOptions(commandOut, { verbose: true }, profileContent);
let xliffMergeCmd = xliff_merge_1.XliffMerge.createFromOptions(commandOut, { verbose: true }, profileContent);
xliffMergeCmd.run();

@@ -150,6 +157,6 @@ expect(ws.writtenData()).toContain('ERROR');

});
it('should output an errror (i18nFile is not readable) when called with a non existing master file', function (done) {
var ws = new writer_to_string_1.WriterToString();
var commandOut = new command_output_1.CommandOutput(ws);
var profileContent = {
it('should output an errror (i18nFile is not readable) when called with a non existing master file', (done) => {
let ws = new writer_to_string_1.WriterToString();
let commandOut = new command_output_1.CommandOutput(ws);
let profileContent = {
xliffmergeOptions: {

@@ -160,3 +167,3 @@ srcDir: 'test/testdata',

};
var xliffMergeCmd = xliff_merge_1.XliffMerge.createFromOptions(commandOut, {}, profileContent);
let xliffMergeCmd = xliff_merge_1.XliffMerge.createFromOptions(commandOut, {}, profileContent);
xliffMergeCmd.run();

@@ -167,6 +174,6 @@ expect(ws.writtenData()).toContain('ERROR');

});
it('should output an errror (language not valid) when called with an invalid language code', function (done) {
var ws = new writer_to_string_1.WriterToString();
var commandOut = new command_output_1.CommandOutput(ws);
var profileContent = {
it('should output an errror (language not valid) when called with an invalid language code', (done) => {
let ws = new writer_to_string_1.WriterToString();
let commandOut = new command_output_1.CommandOutput(ws);
let profileContent = {
xliffmergeOptions: {

@@ -176,3 +183,3 @@ defaultLanguage: 'de/ch',

};
var xliffMergeCmd = xliff_merge_1.XliffMerge.createFromOptions(commandOut, {}, profileContent);
let xliffMergeCmd = xliff_merge_1.XliffMerge.createFromOptions(commandOut, {}, profileContent);
xliffMergeCmd.run();

@@ -183,6 +190,6 @@ expect(ws.writtenData()).toContain('ERROR');

});
it('should output an errror (i18nFormat invalid) when called with an invalid i18n format', function (done) {
var ws = new writer_to_string_1.WriterToString();
var commandOut = new command_output_1.CommandOutput(ws);
var profileContent = {
it('should output an errror (i18nFormat invalid) when called with an invalid i18n format', (done) => {
let ws = new writer_to_string_1.WriterToString();
let commandOut = new command_output_1.CommandOutput(ws);
let profileContent = {
xliffmergeOptions: {

@@ -192,3 +199,3 @@ i18nFormat: 'unknown',

};
var xliffMergeCmd = xliff_merge_1.XliffMerge.createFromOptions(commandOut, {}, profileContent);
let xliffMergeCmd = xliff_merge_1.XliffMerge.createFromOptions(commandOut, {}, profileContent);
xliffMergeCmd.run();

@@ -199,6 +206,6 @@ expect(ws.writtenData()).toContain('ERROR');

});
it('should accept i18n format xlf', function (done) {
var ws = new writer_to_string_1.WriterToString();
var commandOut = new command_output_1.CommandOutput(ws);
var profileContent = {
it('should accept i18n format xlf', (done) => {
let ws = new writer_to_string_1.WriterToString();
let commandOut = new command_output_1.CommandOutput(ws);
let profileContent = {
xliffmergeOptions: {

@@ -208,3 +215,3 @@ i18nFormat: 'xlf',

};
var xliffMergeCmd = xliff_merge_1.XliffMerge.createFromOptions(commandOut, {}, profileContent);
let xliffMergeCmd = xliff_merge_1.XliffMerge.createFromOptions(commandOut, {}, profileContent);
xliffMergeCmd.run();

@@ -214,6 +221,6 @@ expect(ws.writtenData()).not.toContain('i18nFormat');

});
it('should accept i18n format xmb', function (done) {
var ws = new writer_to_string_1.WriterToString();
var commandOut = new command_output_1.CommandOutput(ws);
var profileContent = {
it('should accept i18n format xmb', (done) => {
let ws = new writer_to_string_1.WriterToString();
let commandOut = new command_output_1.CommandOutput(ws);
let profileContent = {
xliffmergeOptions: {

@@ -223,3 +230,3 @@ i18nFormat: 'xmb',

};
var xliffMergeCmd = xliff_merge_1.XliffMerge.createFromOptions(commandOut, {}, profileContent);
let xliffMergeCmd = xliff_merge_1.XliffMerge.createFromOptions(commandOut, {}, profileContent);
xliffMergeCmd.run();

@@ -229,6 +236,6 @@ expect(ws.writtenData()).not.toContain('i18nFormat');

});
it('should read languages from config file', function (done) {
var ws = new writer_to_string_1.WriterToString();
var commandOut = new command_output_1.CommandOutput(ws);
var profileContent = {
it('should read languages from config file', (done) => {
let ws = new writer_to_string_1.WriterToString();
let commandOut = new command_output_1.CommandOutput(ws);
let profileContent = {
xliffmergeOptions: {

@@ -238,3 +245,3 @@ languages: ['de', 'en', 'fr'],

};
var xliffMergeCmd = xliff_merge_1.XliffMerge.createFromOptions(commandOut, { verbose: true }, profileContent);
let xliffMergeCmd = xliff_merge_1.XliffMerge.createFromOptions(commandOut, { verbose: true }, profileContent);
xliffMergeCmd.run();

@@ -245,14 +252,14 @@ expect(ws.writtenData()).toContain('languages: de,en,fr');

});
describe('Merge process checks for format xlf', function () {
var MASTER1FILE = 'ngExtractedMaster1.xlf';
var MASTER2FILE = 'ngExtractedMaster2.xlf';
var MASTER1SRC = SRCDIR + MASTER1FILE;
var MASTER2SRC = SRCDIR + MASTER2FILE;
var MASTERFILE = 'messages.xlf';
var MASTER = WORKDIR + MASTERFILE;
var ID_TRANSLATED_SCHLIESSEN = "1ead0ad1063d0c9e005fe56c9529aef4c1ef9d21"; // an ID from ngExtractedMaster1.xlf
var ID_REMOVED_STARTSEITE = "c536247d71822c272f8e9155f831e0efb5aa0d31"; // an ID that will be removed in master2
var ID_REMOVED_SUCHEN = "d17aee1ddf9fe1c0afe8440e02ef5ab906a69699"; // another removed ID
var ID_WITH_PLACEHOLDER = "af0819ea4a5db68737ebcabde2f5e432b66352e8";
beforeEach(function () {
describe('Merge process checks for format xlf', () => {
let MASTER1FILE = 'ngExtractedMaster1.xlf';
let MASTER2FILE = 'ngExtractedMaster2.xlf';
let MASTER1SRC = SRCDIR + MASTER1FILE;
let MASTER2SRC = SRCDIR + MASTER2FILE;
let MASTERFILE = 'messages.xlf';
let MASTER = WORKDIR + MASTERFILE;
let ID_TRANSLATED_SCHLIESSEN = "1ead0ad1063d0c9e005fe56c9529aef4c1ef9d21"; // an ID from ngExtractedMaster1.xlf
let ID_REMOVED_STARTSEITE = "c536247d71822c272f8e9155f831e0efb5aa0d31"; // an ID that will be removed in master2
let ID_REMOVED_SUCHEN = "d17aee1ddf9fe1c0afe8440e02ef5ab906a69699"; // another removed ID
let ID_WITH_PLACEHOLDER = "af0819ea4a5db68737ebcabde2f5e432b66352e8";
beforeEach(() => {
if (!fs.existsSync(WORKDIR)) {

@@ -264,9 +271,9 @@ fs.mkdirSync(WORKDIR);

});
it('should fix source language, if the masters lang is not the default', function (done) {
it('should fix source language, if the masters lang is not the default', (done) => {
file_util_1.FileUtil.copy(MASTER1SRC, MASTER);
var master = readXliff(MASTER);
let master = readXliff(MASTER);
expect(master.sourceLanguage()).toBe('en'); // master is german, but ng-18n extracts it as en
var ws = new writer_to_string_1.WriterToString();
var commandOut = new command_output_1.CommandOutput(ws);
var profileContent = {
let ws = new writer_to_string_1.WriterToString();
let commandOut = new command_output_1.CommandOutput(ws);
let profileContent = {
xliffmergeOptions: {

@@ -279,3 +286,3 @@ defaultLanguage: 'de',

};
var xliffMergeCmd = xliff_merge_1.XliffMerge.createFromOptions(commandOut, { languages: ['de'] }, profileContent);
let xliffMergeCmd = xliff_merge_1.XliffMerge.createFromOptions(commandOut, { languages: ['de'] }, profileContent);
xliffMergeCmd.run();

@@ -285,11 +292,11 @@ expect(ws.writtenData()).not.toContain('ERROR');

expect(ws.writtenData()).toContain('changed master source-language="en" to "de"');
var newmaster = readXliff(MASTER);
let newmaster = readXliff(MASTER);
expect(newmaster.sourceLanguage()).toBe('de'); // master is german
done();
});
it('should generate translated file for default language de from master', function (done) {
it('should generate translated file for default language de from master', (done) => {
file_util_1.FileUtil.copy(MASTER1SRC, MASTER);
var ws = new writer_to_string_1.WriterToString();
var commandOut = new command_output_1.CommandOutput(ws);
var profileContent = {
let ws = new writer_to_string_1.WriterToString();
let commandOut = new command_output_1.CommandOutput(ws);
let profileContent = {
xliffmergeOptions: {

@@ -302,9 +309,9 @@ defaultLanguage: 'de',

};
var xliffMergeCmd = xliff_merge_1.XliffMerge.createFromOptions(commandOut, { languages: ['de'] }, profileContent);
let xliffMergeCmd = xliff_merge_1.XliffMerge.createFromOptions(commandOut, { languages: ['de'] }, profileContent);
xliffMergeCmd.run();
expect(ws.writtenData()).not.toContain('ERROR');
var langFile = readXliff(xliffMergeCmd.generatedI18nFile('de'));
let langFile = readXliff(xliffMergeCmd.generatedI18nFile('de'));
expect(langFile.sourceLanguage()).toBe('de');
expect(langFile.targetLanguage()).toBe('de');
langFile.forEachTransUnit(function (tu) {
langFile.forEachTransUnit((tu) => {
expect(tu.targetContent()).toBe(tu.sourceContent());

@@ -315,7 +322,7 @@ expect(tu.targetState()).toBe('final');

});
it('should generate translated file for all languages', function (done) {
it('should generate translated file for all languages', (done) => {
file_util_1.FileUtil.copy(MASTER1SRC, MASTER);
var ws = new writer_to_string_1.WriterToString();
var commandOut = new command_output_1.CommandOutput(ws);
var profileContent = {
let ws = new writer_to_string_1.WriterToString();
let commandOut = new command_output_1.CommandOutput(ws);
let profileContent = {
xliffmergeOptions: {

@@ -328,16 +335,16 @@ defaultLanguage: 'de',

};
var xliffMergeCmd = xliff_merge_1.XliffMerge.createFromOptions(commandOut, { languages: ['de', 'en'] }, profileContent);
let xliffMergeCmd = xliff_merge_1.XliffMerge.createFromOptions(commandOut, { languages: ['de', 'en'] }, profileContent);
xliffMergeCmd.run();
expect(ws.writtenData()).not.toContain('ERROR');
var langFileGerman = readXliff(xliffMergeCmd.generatedI18nFile('de'));
let langFileGerman = readXliff(xliffMergeCmd.generatedI18nFile('de'));
expect(langFileGerman.sourceLanguage()).toBe('de');
expect(langFileGerman.targetLanguage()).toBe('de');
langFileGerman.forEachTransUnit(function (tu) {
langFileGerman.forEachTransUnit((tu) => {
expect(tu.targetContent()).toBe(tu.sourceContent());
expect(tu.targetState()).toBe('final');
});
var langFileEnglish = readXliff(xliffMergeCmd.generatedI18nFile('en'));
let langFileEnglish = readXliff(xliffMergeCmd.generatedI18nFile('en'));
expect(langFileEnglish.sourceLanguage()).toBe('de');
expect(langFileEnglish.targetLanguage()).toBe('en');
langFileEnglish.forEachTransUnit(function (tu) {
langFileEnglish.forEachTransUnit((tu) => {
expect(tu.targetContent()).toBe(tu.sourceContent());

@@ -348,7 +355,7 @@ expect(tu.targetState()).toBe('new');

});
it('should merge translated file for all languages', function (done) {
it('should merge translated file for all languages', (done) => {
file_util_1.FileUtil.copy(MASTER1SRC, MASTER);
var ws = new writer_to_string_1.WriterToString();
var commandOut = new command_output_1.CommandOutput(ws);
var profileContent = {
let ws = new writer_to_string_1.WriterToString();
let commandOut = new command_output_1.CommandOutput(ws);
let profileContent = {
xliffmergeOptions: {

@@ -361,8 +368,8 @@ defaultLanguage: 'de',

};
var xliffMergeCmd = xliff_merge_1.XliffMerge.createFromOptions(commandOut, { languages: ['de', 'en'] }, profileContent);
let xliffMergeCmd = xliff_merge_1.XliffMerge.createFromOptions(commandOut, { languages: ['de', 'en'] }, profileContent);
xliffMergeCmd.run();
expect(ws.writtenData()).not.toContain('ERROR');
// now translate some texts in the English version
var langFileEnglish = readXliff(xliffMergeCmd.generatedI18nFile('en'));
var tu = langFileEnglish.transUnitWithId(ID_TRANSLATED_SCHLIESSEN);
let langFileEnglish = readXliff(xliffMergeCmd.generatedI18nFile('en'));
let tu = langFileEnglish.transUnitWithId(ID_TRANSLATED_SCHLIESSEN);
expect(tu).toBeTruthy();

@@ -388,7 +395,7 @@ langFileEnglish.translate(tu, 'Close');

});
it('should translate messages with placeholder', function (done) {
it('should translate messages with placeholder', (done) => {
file_util_1.FileUtil.copy(MASTER2SRC, MASTER);
var ws = new writer_to_string_1.WriterToString();
var commandOut = new command_output_1.CommandOutput(ws);
var profileContent = {
let ws = new writer_to_string_1.WriterToString();
let commandOut = new command_output_1.CommandOutput(ws);
let profileContent = {
xliffmergeOptions: {

@@ -401,8 +408,8 @@ defaultLanguage: 'de',

};
var xliffMergeCmd = xliff_merge_1.XliffMerge.createFromOptions(commandOut, { languages: ['de', 'en'] }, profileContent);
let xliffMergeCmd = xliff_merge_1.XliffMerge.createFromOptions(commandOut, { languages: ['de', 'en'] }, profileContent);
xliffMergeCmd.run();
expect(ws.writtenData()).not.toContain('ERROR');
// now translate some texts in the English version
var langFileEnglish = readXliff(xliffMergeCmd.generatedI18nFile('en'));
var tu = langFileEnglish.transUnitWithId(ID_WITH_PLACEHOLDER);
let langFileEnglish = readXliff(xliffMergeCmd.generatedI18nFile('en'));
let tu = langFileEnglish.transUnitWithId(ID_WITH_PLACEHOLDER);
expect(tu).toBeTruthy();

@@ -417,10 +424,10 @@ langFileEnglish.translate(tu, 'Item <x id="INTERPOLATION"/> of <x id="INTERPOLATION_1"/> added.');

});
describe('ngx-translate processing for format xlf', function () {
var MASTER1FILE = 'ngxtranslate.xlf';
var MASTER1SRC = SRCDIR + MASTER1FILE;
var MASTERFILE = 'messages.xlf';
var MASTER = WORKDIR + MASTERFILE;
var ID_NODESC_NOMEANING = "a8f10794864e49b16224b22faaf4a86229b6c53d"; // an ID without set meaning and description
var ID_MONDAY = "84e8cd8ba480129d90f512cc3462bb43efcf389f"; // an ID from ngxtranslate.xlf with meaning "x.y" and description "ngx-translate"
beforeEach(function () {
describe('ngx-translate processing for format xlf', () => {
let MASTER1FILE = 'ngxtranslate.xlf';
let MASTER1SRC = SRCDIR + MASTER1FILE;
let MASTERFILE = 'messages.xlf';
let MASTER = WORKDIR + MASTERFILE;
let ID_NODESC_NOMEANING = "a8f10794864e49b16224b22faaf4a86229b6c53d"; // an ID without set meaning and description
let ID_MONDAY = "84e8cd8ba480129d90f512cc3462bb43efcf389f"; // an ID from ngxtranslate.xlf with meaning "x.y" and description "ngx-translate"
beforeEach(() => {
if (!fs.existsSync(WORKDIR)) {

@@ -432,5 +439,5 @@ fs.mkdirSync(WORKDIR);

});
it('should return null for unset description and meaning in master xlf file', function (done) {
it('should return null for unset description and meaning in master xlf file', (done) => {
file_util_1.FileUtil.copy(MASTER1SRC, MASTER);
var master = readXliff(MASTER);
let master = readXliff(MASTER);
expect(master.transUnitWithId(ID_NODESC_NOMEANING).description()).toBeFalsy();

@@ -440,5 +447,5 @@ expect(master.transUnitWithId(ID_NODESC_NOMEANING).meaning()).toBeFalsy();

});
it('should find description and meaning in master xlf file', function (done) {
it('should find description and meaning in master xlf file', (done) => {
file_util_1.FileUtil.copy(MASTER1SRC, MASTER);
var master = readXliff(MASTER);
let master = readXliff(MASTER);
expect(master.transUnitWithId(ID_MONDAY).description()).toBe('ngx-translate');

@@ -448,7 +455,7 @@ expect(master.transUnitWithId(ID_MONDAY).meaning()).toBe('dateservice.monday');

});
it('should find description and meaning in translated xlf file', function (done) {
it('should find description and meaning in translated xlf file', (done) => {
file_util_1.FileUtil.copy(MASTER1SRC, MASTER);
var ws = new writer_to_string_1.WriterToString();
var commandOut = new command_output_1.CommandOutput(ws);
var profileContent = {
let ws = new writer_to_string_1.WriterToString();
let commandOut = new command_output_1.CommandOutput(ws);
let profileContent = {
xliffmergeOptions: {

@@ -461,6 +468,6 @@ defaultLanguage: 'de',

};
var xliffMergeCmd = xliff_merge_1.XliffMerge.createFromOptions(commandOut, { languages: ['de'] }, profileContent);
let xliffMergeCmd = xliff_merge_1.XliffMerge.createFromOptions(commandOut, { languages: ['de'] }, profileContent);
xliffMergeCmd.run();
expect(ws.writtenData()).not.toContain('ERROR');
var langFile = readXliff(xliffMergeCmd.generatedI18nFile('de'));
let langFile = readXliff(xliffMergeCmd.generatedI18nFile('de'));
expect(langFile.transUnitWithId(ID_MONDAY).description()).toBe('ngx-translate');

@@ -470,7 +477,7 @@ expect(langFile.transUnitWithId(ID_MONDAY).meaning()).toBe('dateservice.monday');

});
it('should write translation json file for ngx-translate', function (done) {
it('should write translation json file for ngx-translate', (done) => {
file_util_1.FileUtil.copy(MASTER1SRC, MASTER);
var ws = new writer_to_string_1.WriterToString();
var commandOut = new command_output_1.CommandOutput(ws);
var profileContent = {
let ws = new writer_to_string_1.WriterToString();
let commandOut = new command_output_1.CommandOutput(ws);
let profileContent = {
xliffmergeOptions: {

@@ -484,9 +491,9 @@ defaultLanguage: 'de',

};
var xliffMergeCmd = xliff_merge_1.XliffMerge.createFromOptions(commandOut, { languages: ['de'] }, profileContent);
let xliffMergeCmd = xliff_merge_1.XliffMerge.createFromOptions(commandOut, { languages: ['de'] }, profileContent);
xliffMergeCmd.run();
expect(ws.writtenData()).not.toContain('ERROR');
var translationJsonFilename = xliffMergeCmd.generatedNgxTranslateFile('de');
let translationJsonFilename = xliffMergeCmd.generatedNgxTranslateFile('de');
expect(file_util_1.FileUtil.exists(translationJsonFilename)).toBeTruthy();
var fileContent = file_util_1.FileUtil.read(translationJsonFilename, 'UTF-8');
var translation = JSON.parse(fileContent);
let fileContent = file_util_1.FileUtil.read(translationJsonFilename, 'UTF-8');
let translation = JSON.parse(fileContent);
expect(translation).toBeTruthy();

@@ -498,7 +505,7 @@ expect(translation.myapp).toBeTruthy();

});
it('should handle placeholders in json file for ngx-translate', function (done) {
it('should handle placeholders in json file for ngx-translate', (done) => {
file_util_1.FileUtil.copy(MASTER1SRC, MASTER);
var ws = new writer_to_string_1.WriterToString();
var commandOut = new command_output_1.CommandOutput(ws);
var profileContent = {
let ws = new writer_to_string_1.WriterToString();
let commandOut = new command_output_1.CommandOutput(ws);
let profileContent = {
xliffmergeOptions: {

@@ -512,9 +519,9 @@ defaultLanguage: 'de',

};
var xliffMergeCmd = xliff_merge_1.XliffMerge.createFromOptions(commandOut, { languages: ['de'] }, profileContent);
let xliffMergeCmd = xliff_merge_1.XliffMerge.createFromOptions(commandOut, { languages: ['de'] }, profileContent);
xliffMergeCmd.run();
expect(ws.writtenData()).not.toContain('ERROR');
var translationJsonFilename = xliffMergeCmd.generatedNgxTranslateFile('de');
let translationJsonFilename = xliffMergeCmd.generatedNgxTranslateFile('de');
expect(file_util_1.FileUtil.exists(translationJsonFilename)).toBeTruthy();
var fileContent = file_util_1.FileUtil.read(translationJsonFilename, 'UTF-8');
var translation = JSON.parse(fileContent);
let fileContent = file_util_1.FileUtil.read(translationJsonFilename, 'UTF-8');
let translation = JSON.parse(fileContent);
expect(translation).toBeTruthy();

@@ -527,7 +534,7 @@ expect(translation.placeholders).toBeTruthy();

});
it('should handle embedded html markup in json file for ngx-translate', function (done) {
it('should handle embedded html markup in json file for ngx-translate', (done) => {
file_util_1.FileUtil.copy(MASTER1SRC, MASTER);
var ws = new writer_to_string_1.WriterToString();
var commandOut = new command_output_1.CommandOutput(ws);
var profileContent = {
let ws = new writer_to_string_1.WriterToString();
let commandOut = new command_output_1.CommandOutput(ws);
let profileContent = {
xliffmergeOptions: {

@@ -541,9 +548,9 @@ defaultLanguage: 'de',

};
var xliffMergeCmd = xliff_merge_1.XliffMerge.createFromOptions(commandOut, { languages: ['de'] }, profileContent);
let xliffMergeCmd = xliff_merge_1.XliffMerge.createFromOptions(commandOut, { languages: ['de'] }, profileContent);
xliffMergeCmd.run();
expect(ws.writtenData()).not.toContain('ERROR');
var translationJsonFilename = xliffMergeCmd.generatedNgxTranslateFile('de');
let translationJsonFilename = xliffMergeCmd.generatedNgxTranslateFile('de');
expect(file_util_1.FileUtil.exists(translationJsonFilename)).toBeTruthy();
var fileContent = file_util_1.FileUtil.read(translationJsonFilename, 'UTF-8');
var translation = JSON.parse(fileContent);
let fileContent = file_util_1.FileUtil.read(translationJsonFilename, 'UTF-8');
let translation = JSON.parse(fileContent);
expect(translation).toBeTruthy();

@@ -557,15 +564,15 @@ expect(translation.embeddedhtml).toBeTruthy();

});
describe('Merge process checks for format xmb', function () {
var MASTER1FILE = 'ngExtractedMaster1.xmb';
var MASTER2FILE = 'ngExtractedMaster2.xmb';
var MASTER1SRC = SRCDIR + MASTER1FILE;
var MASTER2SRC = SRCDIR + MASTER2FILE;
var MASTERFILE = 'messages.xmb';
var MASTER = WORKDIR + MASTERFILE;
var ID_TRANSLATED_MYFIRST = "2047558209369508311"; // an ID from ngExtractedMaster1.xlf
var ID_REMOVED_DESCRIPTION = "7499557905529977371"; // an ID that will be removed in master2
var ID_REMOVED_DESCRIPTION2 = "3274258156935474372"; // another removed ID
var ID_ADDED = "8998006760999956868"; // an ID that will be added in master2
var ID_WITH_PLACEHOLDER = "9030312858648510700";
beforeEach(function () {
describe('Merge process checks for format xmb', () => {
let MASTER1FILE = 'ngExtractedMaster1.xmb';
let MASTER2FILE = 'ngExtractedMaster2.xmb';
let MASTER1SRC = SRCDIR + MASTER1FILE;
let MASTER2SRC = SRCDIR + MASTER2FILE;
let MASTERFILE = 'messages.xmb';
let MASTER = WORKDIR + MASTERFILE;
let ID_TRANSLATED_MYFIRST = "2047558209369508311"; // an ID from ngExtractedMaster1.xlf
let ID_REMOVED_DESCRIPTION = "7499557905529977371"; // an ID that will be removed in master2
let ID_REMOVED_DESCRIPTION2 = "3274258156935474372"; // another removed ID
let ID_ADDED = "8998006760999956868"; // an ID that will be added in master2
let ID_WITH_PLACEHOLDER = "9030312858648510700";
beforeEach(() => {
if (!fs.existsSync(WORKDIR)) {

@@ -577,7 +584,7 @@ fs.mkdirSync(WORKDIR);

});
it('should generate translated file for default language de from xmb master', function (done) {
it('should generate translated file for default language de from xmb master', (done) => {
file_util_1.FileUtil.copy(MASTER1SRC, MASTER);
var ws = new writer_to_string_1.WriterToString();
var commandOut = new command_output_1.CommandOutput(ws);
var profileContent = {
let ws = new writer_to_string_1.WriterToString();
let commandOut = new command_output_1.CommandOutput(ws);
let profileContent = {
xliffmergeOptions: {

@@ -591,9 +598,9 @@ defaultLanguage: 'de',

};
var xliffMergeCmd = xliff_merge_1.XliffMerge.createFromOptions(commandOut, { languages: ['de'] }, profileContent);
let xliffMergeCmd = xliff_merge_1.XliffMerge.createFromOptions(commandOut, { languages: ['de'] }, profileContent);
xliffMergeCmd.run();
expect(ws.writtenData()).not.toContain('ERROR');
var langFile = readXmb(xliffMergeCmd.generatedI18nFile('de'));
expect(langFile.sourceLanguage()).toBeFalsy(); // not supported in xmb
expect(langFile.targetLanguage()).toBeFalsy();
langFile.forEachTransUnit(function (tu) {
let langFile = readXmb(xliffMergeCmd.generatedI18nFile('de'));
expect(langFile.sourceLanguage()).toBeFalsy(); // not supported in xmb when there is no master
expect(langFile.targetLanguage()).toBe('de'); // guess from filename
langFile.forEachTransUnit((tu) => {
expect(tu.targetContent()).toBe(tu.sourceContent());

@@ -604,7 +611,7 @@ expect(tu.targetState()).toBeFalsy();

});
it('should generate translated file for all languages using format xmb', function (done) {
it('should generate translated file for all languages using format xmb', (done) => {
file_util_1.FileUtil.copy(MASTER1SRC, MASTER);
var ws = new writer_to_string_1.WriterToString();
var commandOut = new command_output_1.CommandOutput(ws);
var profileContent = {
let ws = new writer_to_string_1.WriterToString();
let commandOut = new command_output_1.CommandOutput(ws);
let profileContent = {
xliffmergeOptions: {

@@ -618,11 +625,11 @@ defaultLanguage: 'de',

};
var xliffMergeCmd = xliff_merge_1.XliffMerge.createFromOptions(commandOut, { languages: ['de', 'en'] }, profileContent);
let xliffMergeCmd = xliff_merge_1.XliffMerge.createFromOptions(commandOut, { languages: ['de', 'en'] }, profileContent);
xliffMergeCmd.run();
expect(ws.writtenData()).not.toContain('ERROR');
var langFileGerman = readXmb(xliffMergeCmd.generatedI18nFile('de'));
langFileGerman.forEachTransUnit(function (tu) {
let langFileGerman = readXmb(xliffMergeCmd.generatedI18nFile('de'));
langFileGerman.forEachTransUnit((tu) => {
expect(tu.targetContent()).toBe(tu.sourceContent());
});
var langFileEnglish = readXmb(xliffMergeCmd.generatedI18nFile('en'));
langFileEnglish.forEachTransUnit(function (tu) {
let langFileEnglish = readXmb(xliffMergeCmd.generatedI18nFile('en'));
langFileEnglish.forEachTransUnit((tu) => {
expect(tu.targetContent()).toBe(tu.sourceContent());

@@ -632,7 +639,7 @@ });

});
it('should merge translated file for all languages using format xmb', function (done) {
it('should merge translated file for all languages using format xmb', (done) => {
file_util_1.FileUtil.copy(MASTER1SRC, MASTER);
var ws = new writer_to_string_1.WriterToString();
var commandOut = new command_output_1.CommandOutput(ws);
var profileContent = {
let ws = new writer_to_string_1.WriterToString();
let commandOut = new command_output_1.CommandOutput(ws);
let profileContent = {
xliffmergeOptions: {

@@ -646,8 +653,8 @@ defaultLanguage: 'de',

};
var xliffMergeCmd = xliff_merge_1.XliffMerge.createFromOptions(commandOut, { languages: ['de', 'en'] }, profileContent);
let xliffMergeCmd = xliff_merge_1.XliffMerge.createFromOptions(commandOut, { languages: ['de', 'en'] }, profileContent);
xliffMergeCmd.run();
expect(ws.writtenData()).not.toContain('ERROR');
// now translate some texts in the English version
var langFileEnglish = readXmb(xliffMergeCmd.generatedI18nFile('en'));
var tu = langFileEnglish.transUnitWithId(ID_TRANSLATED_MYFIRST);
let langFileEnglish = readXmb(xliffMergeCmd.generatedI18nFile('en'));
let tu = langFileEnglish.transUnitWithId(ID_TRANSLATED_MYFIRST);
expect(tu).toBeTruthy();

@@ -675,7 +682,7 @@ langFileEnglish.translate(tu, 'My first app');

});
it('should translate messages with placeholder in format xmb', function (done) {
it('should translate messages with placeholder in format xmb', (done) => {
file_util_1.FileUtil.copy(MASTER2SRC, MASTER);
var ws = new writer_to_string_1.WriterToString();
var commandOut = new command_output_1.CommandOutput(ws);
var profileContent = {
let ws = new writer_to_string_1.WriterToString();
let commandOut = new command_output_1.CommandOutput(ws);
let profileContent = {
xliffmergeOptions: {

@@ -689,8 +696,8 @@ defaultLanguage: 'de',

};
var xliffMergeCmd = xliff_merge_1.XliffMerge.createFromOptions(commandOut, { languages: ['de', 'en'] }, profileContent);
let xliffMergeCmd = xliff_merge_1.XliffMerge.createFromOptions(commandOut, { languages: ['de', 'en'] }, profileContent);
xliffMergeCmd.run();
expect(ws.writtenData()).not.toContain('ERROR');
// now translate some texts in the English version
var langFileEnglish = readXmb(xliffMergeCmd.generatedI18nFile('en'));
var tu = langFileEnglish.transUnitWithId(ID_WITH_PLACEHOLDER);
let langFileEnglish = readXmb(xliffMergeCmd.generatedI18nFile('en'));
let tu = langFileEnglish.transUnitWithId(ID_WITH_PLACEHOLDER);
expect(tu).toBeTruthy();

@@ -704,11 +711,59 @@ langFileEnglish.translate(tu, 'Item <ph name="INTERPOLATION"><ex>INTERPOLATION</ex></ph> of <ph name="INTERPOLATION_1"><ex>INTERPOLATION_1</ex></ph> added.');

});
it('should return status new for all trans units using format xmb with master file', (done) => {
file_util_1.FileUtil.copy(MASTER1SRC, MASTER);
let ws = new writer_to_string_1.WriterToString();
let commandOut = new command_output_1.CommandOutput(ws);
let profileContent = {
xliffmergeOptions: {
defaultLanguage: 'de',
srcDir: WORKDIR,
genDir: WORKDIR,
i18nFile: MASTERFILE,
i18nFormat: 'xmb'
}
};
let xliffMergeCmd = xliff_merge_1.XliffMerge.createFromOptions(commandOut, { languages: ['de', 'en'] }, profileContent);
xliffMergeCmd.run();
expect(ws.writtenData()).not.toContain('ERROR');
let langFileEnglish = readXmbWithMaster(xliffMergeCmd.generatedI18nFile('en'), MASTER);
langFileEnglish.forEachTransUnit((tu) => {
expect(tu.targetState()).toBe('new');
});
done();
});
it('should return status final for a translated trans unit using format xmb with master file', (done) => {
file_util_1.FileUtil.copy(MASTER1SRC, MASTER);
let ws = new writer_to_string_1.WriterToString();
let commandOut = new command_output_1.CommandOutput(ws);
let profileContent = {
xliffmergeOptions: {
defaultLanguage: 'de',
srcDir: WORKDIR,
genDir: WORKDIR,
i18nFile: MASTERFILE,
i18nFormat: 'xmb'
}
};
let xliffMergeCmd = xliff_merge_1.XliffMerge.createFromOptions(commandOut, { languages: ['de', 'en'] }, profileContent);
xliffMergeCmd.run();
expect(ws.writtenData()).not.toContain('ERROR');
let langFileEnglish = readXmbWithMaster(xliffMergeCmd.generatedI18nFile('en'), MASTER);
// now translate some texts in the English version
let tu = langFileEnglish.transUnitWithId(ID_TRANSLATED_MYFIRST);
expect(tu).toBeTruthy();
expect(tu.sourceContent()).toBe('Meine erste I18N-Anwendung');
expect(tu.targetState()).toBe('new');
langFileEnglish.translate(tu, 'my first i18n application');
expect(tu.targetState()).toBe('final');
done();
});
});
describe('ngx-translate processing for format xmb', function () {
var MASTER1FILE = 'ngxtranslate.xmb';
var MASTER1SRC = SRCDIR + MASTER1FILE;
var MASTERFILE = 'messages.xmb';
var MASTER = WORKDIR + MASTERFILE;
var ID_NODESC_NOMEANING = "2047558209369508311"; // an ID without set meaning and description
var ID_MONDAY = "6830980354990918030"; // an ID from ngxtranslate.xmb with meaning "x.y" and description "ngx-translate"
beforeEach(function () {
describe('ngx-translate processing for format xmb', () => {
let MASTER1FILE = 'ngxtranslate.xmb';
let MASTER1SRC = SRCDIR + MASTER1FILE;
let MASTERFILE = 'messages.xmb';
let MASTER = WORKDIR + MASTERFILE;
let ID_NODESC_NOMEANING = "2047558209369508311"; // an ID without set meaning and description
let ID_MONDAY = "6830980354990918030"; // an ID from ngxtranslate.xmb with meaning "x.y" and description "ngx-translate"
beforeEach(() => {
if (!fs.existsSync(WORKDIR)) {

@@ -720,5 +775,5 @@ fs.mkdirSync(WORKDIR);

});
it('should return null for unset description and meaning in master xmb file', function (done) {
it('should return null for unset description and meaning in master xmb file', (done) => {
file_util_1.FileUtil.copy(MASTER1SRC, MASTER);
var master = readXmb(MASTER);
let master = readXmb(MASTER);
expect(master.transUnitWithId(ID_NODESC_NOMEANING).description()).toBeFalsy();

@@ -728,5 +783,5 @@ expect(master.transUnitWithId(ID_NODESC_NOMEANING).meaning()).toBeFalsy();

});
it('should find description and meaning in master xmb file', function (done) {
it('should find description and meaning in master xmb file', (done) => {
file_util_1.FileUtil.copy(MASTER1SRC, MASTER);
var master = readXmb(MASTER);
let master = readXmb(MASTER);
expect(master.transUnitWithId(ID_MONDAY).description()).toBe('ngx-translate');

@@ -736,7 +791,7 @@ expect(master.transUnitWithId(ID_MONDAY).meaning()).toBe('dateservice.monday');

});
it('should find description and meaning in translated xmb file', function (done) {
it('should find description and meaning in translated xmb file', (done) => {
file_util_1.FileUtil.copy(MASTER1SRC, MASTER);
var ws = new writer_to_string_1.WriterToString();
var commandOut = new command_output_1.CommandOutput(ws);
var profileContent = {
let ws = new writer_to_string_1.WriterToString();
let commandOut = new command_output_1.CommandOutput(ws);
let profileContent = {
xliffmergeOptions: {

@@ -750,6 +805,6 @@ defaultLanguage: 'de',

};
var xliffMergeCmd = xliff_merge_1.XliffMerge.createFromOptions(commandOut, { languages: ['de'] }, profileContent);
let xliffMergeCmd = xliff_merge_1.XliffMerge.createFromOptions(commandOut, { languages: ['de'] }, profileContent);
xliffMergeCmd.run();
expect(ws.writtenData()).not.toContain('ERROR');
var langFile = readXmb(xliffMergeCmd.generatedI18nFile('de'));
let langFile = readXmb(xliffMergeCmd.generatedI18nFile('de'));
expect(langFile.transUnitWithId(ID_MONDAY).description()).toBe('ngx-translate');

@@ -759,7 +814,7 @@ expect(langFile.transUnitWithId(ID_MONDAY).meaning()).toBe('dateservice.monday');

});
it('should write translation json file for ngx-translate', function (done) {
it('should write translation json file for ngx-translate', (done) => {
file_util_1.FileUtil.copy(MASTER1SRC, MASTER);
var ws = new writer_to_string_1.WriterToString();
var commandOut = new command_output_1.CommandOutput(ws);
var profileContent = {
let ws = new writer_to_string_1.WriterToString();
let commandOut = new command_output_1.CommandOutput(ws);
let profileContent = {
xliffmergeOptions: {

@@ -774,9 +829,9 @@ defaultLanguage: 'de',

};
var xliffMergeCmd = xliff_merge_1.XliffMerge.createFromOptions(commandOut, { languages: ['de'] }, profileContent);
let xliffMergeCmd = xliff_merge_1.XliffMerge.createFromOptions(commandOut, { languages: ['de'] }, profileContent);
xliffMergeCmd.run();
expect(ws.writtenData()).not.toContain('ERROR');
var translationJsonFilename = xliffMergeCmd.generatedNgxTranslateFile('de');
let translationJsonFilename = xliffMergeCmd.generatedNgxTranslateFile('de');
expect(file_util_1.FileUtil.exists(translationJsonFilename)).toBeTruthy();
var fileContent = file_util_1.FileUtil.read(translationJsonFilename, 'UTF-8');
var translation = JSON.parse(fileContent);
let fileContent = file_util_1.FileUtil.read(translationJsonFilename, 'UTF-8');
let translation = JSON.parse(fileContent);
expect(translation).toBeTruthy();

@@ -788,7 +843,7 @@ expect(translation.myapp).toBeTruthy();

});
it('should handle placeholders in json file for ngx-translate', function (done) {
it('should handle placeholders in json file for ngx-translate', (done) => {
file_util_1.FileUtil.copy(MASTER1SRC, MASTER);
var ws = new writer_to_string_1.WriterToString();
var commandOut = new command_output_1.CommandOutput(ws);
var profileContent = {
let ws = new writer_to_string_1.WriterToString();
let commandOut = new command_output_1.CommandOutput(ws);
let profileContent = {
xliffmergeOptions: {

@@ -803,9 +858,9 @@ defaultLanguage: 'de',

};
var xliffMergeCmd = xliff_merge_1.XliffMerge.createFromOptions(commandOut, { languages: ['de'] }, profileContent);
let xliffMergeCmd = xliff_merge_1.XliffMerge.createFromOptions(commandOut, { languages: ['de'] }, profileContent);
xliffMergeCmd.run();
expect(ws.writtenData()).not.toContain('ERROR');
var translationJsonFilename = xliffMergeCmd.generatedNgxTranslateFile('de');
let translationJsonFilename = xliffMergeCmd.generatedNgxTranslateFile('de');
expect(file_util_1.FileUtil.exists(translationJsonFilename)).toBeTruthy();
var fileContent = file_util_1.FileUtil.read(translationJsonFilename, 'UTF-8');
var translation = JSON.parse(fileContent);
let fileContent = file_util_1.FileUtil.read(translationJsonFilename, 'UTF-8');
let translation = JSON.parse(fileContent);
expect(translation).toBeTruthy();

@@ -818,7 +873,7 @@ expect(translation.placeholders).toBeTruthy();

});
it('should handle embedded html markup in json file for ngx-translate', function (done) {
it('should handle embedded html markup in json file for ngx-translate', (done) => {
file_util_1.FileUtil.copy(MASTER1SRC, MASTER);
var ws = new writer_to_string_1.WriterToString();
var commandOut = new command_output_1.CommandOutput(ws);
var profileContent = {
let ws = new writer_to_string_1.WriterToString();
let commandOut = new command_output_1.CommandOutput(ws);
let profileContent = {
xliffmergeOptions: {

@@ -833,9 +888,9 @@ defaultLanguage: 'de',

};
var xliffMergeCmd = xliff_merge_1.XliffMerge.createFromOptions(commandOut, { languages: ['de'] }, profileContent);
let xliffMergeCmd = xliff_merge_1.XliffMerge.createFromOptions(commandOut, { languages: ['de'] }, profileContent);
xliffMergeCmd.run();
expect(ws.writtenData()).not.toContain('ERROR');
var translationJsonFilename = xliffMergeCmd.generatedNgxTranslateFile('de');
let translationJsonFilename = xliffMergeCmd.generatedNgxTranslateFile('de');
expect(file_util_1.FileUtil.exists(translationJsonFilename)).toBeTruthy();
var fileContent = file_util_1.FileUtil.read(translationJsonFilename, 'UTF-8');
var translation = JSON.parse(fileContent);
let fileContent = file_util_1.FileUtil.read(translationJsonFilename, 'UTF-8');
let translation = JSON.parse(fileContent);
expect(translation).toBeTruthy();

@@ -850,2 +905,2 @@ expect(translation.embeddedhtml).toBeTruthy();

});
//# sourceMappingURL=s:/experimente/ngx-i18nsupport/src/xliffmerge/xliff-merge.spec.js.map
//# sourceMappingURL=S:/experimente/ngx-i18nsupport/src/xliffmerge/xliff-merge.spec.js.map
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var file_util_1 = require("../common/file-util");
const file_util_1 = require("../common/file-util");
/**

@@ -8,5 +8,3 @@ * Created by martin on 10.03.2017.

*/
var XmlReader = (function () {
function XmlReader() {
}
class XmlReader {
/**

@@ -19,8 +17,8 @@ * Read an xml-File.

*/
XmlReader.readXmlFileContent = function (path, encoding) {
static readXmlFileContent(path, encoding) {
if (!encoding) {
encoding = XmlReader.DEFAULT_ENCODING;
}
var content = file_util_1.FileUtil.read(path, encoding);
var foundEncoding = XmlReader.encodingFromXml(content);
let content = file_util_1.FileUtil.read(path, encoding);
let foundEncoding = XmlReader.encodingFromXml(content);
if (foundEncoding != encoding) {

@@ -34,3 +32,3 @@ // read again with the correct encoding

};
};
}
/**

@@ -42,14 +40,13 @@ * Read the encoding from the xml.

*/
XmlReader.encodingFromXml = function (xmlString) {
var index = xmlString.indexOf('encoding="');
static encodingFromXml(xmlString) {
let index = xmlString.indexOf('encoding="');
if (index < 0) {
return this.DEFAULT_ENCODING; // default in xml if not explicitly set
}
var endIndex = xmlString.indexOf('"', index + 10); // 10 = length of 'encoding="'
let endIndex = xmlString.indexOf('"', index + 10); // 10 = length of 'encoding="'
return xmlString.substring(index + 10, endIndex);
};
return XmlReader;
}());
}
}
XmlReader.DEFAULT_ENCODING = 'UTF-8';
exports.XmlReader = XmlReader;
//# sourceMappingURL=s:/experimente/ngx-i18nsupport/src/xliffmerge/xml-reader.js.map
//# sourceMappingURL=S:/experimente/ngx-i18nsupport/src/xliffmerge/xml-reader.js.map
{
"name": "ngx-i18nsupport",
"version": "0.2.3",
"version": "0.3.0",
"description": "Some tooling to be used with the Angular 2 i18n workflow",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -85,17 +85,34 @@ [![Build Status][travis-badge]][travis-badge-url]

<pre>
"xliffmerge": {
"srcDir: "i18n", // directory, where the master file is expected
"genDir": "i18n", // directory, where files are written to (normally identical with srcDir)
"i18nFile": "messages.xlf", // master file (relativ to srcDir)
"i18nFormat": "xlf", // "xlf" for XLIFF or "xmb" for XML Message Bundles
"encoding": "UTF-8", // expected encoding of xlf or xmb files
"defaultLanguage": "en", // the native language used in your templates
"languages": ["en", "de"], // list of languages (if not spefified at command line)
"removeUnusedIds": true, // flag, if unused IDs should be removed during merge
"supportNgxTranslate": true, // flag to active json translation files for ngx-translate
"verbose": false, // controls output
"quiet": false, // controls output
{
"xliffmergeOptions": {
"srcDir": "i18n",
"genDir": "i18n",
"i18nFile": "messages.xlf",
"i18nFormat": "xlf",
"encoding": "UTF-8",
"defaultLanguage": "en",
"languages": ["en", "de"],
"removeUnusedIds": true,
"supportNgxTranslate": true,
"useSourceAsTarget": false,
"verbose": false,
"quiet": false,
}
}
</pre>
The options are:
- `srcDir` (string, default "."): directory, where the master file is expected
- `genDir` (string, default "."): directory, where files are written to (normally identical with srcDir)
- `i18nFile` (string, default "messages.xlf"): master file (relativ to srcDir)
- `i18nFormat` (string, default "xlf"): "xlf" for XLIFF or "xmb" for XML Message Bundles
- `encoding` (string, default "UTF-8"): expected encoding of xlf or xmb files
- `defaultLanguage` (string, default "en"): the native language used in your templates
- `languages` (array of strings): list of languages (if not spefified at command line)
- `removeUnusedIds` (boolean, default `true`): flag, if unused IDs should be removed during merge
- `supportNgxTranslate` (boolean, default `false`): flag to active json translation files for ngx-translate
- `useSourceAsTarget` (boolean, default `true`): flag, if source should be copied to target for new trans-units
- `verbose` (boolean, default `false`): controls output
- `quiet` (boolean, default `false`): controls output
### Generate (untranslated) language files, if not already there

@@ -135,2 +152,5 @@ When you run `xliffmerge`, it will read the master xliff file **messages.xlf**.

>Have a look at my sister project [TinyTranslator](https://github.com/martinroob/tiny-translator).
It can filter for new untranslated entries and allows to edit xlf file very easily.
The file for English on the other hand is correct.

@@ -166,2 +186,4 @@ So, due to the fact, that English is the **default language** here, the state is `translated`.

>Once again: [TinyTranslator](https://github.com/martinroob/tiny-translator) might help you to do that.
## Tests

@@ -185,3 +207,4 @@

* Roland Oldengarm: [Angular 2: Automated i18n workflow using gulp](http://rolandoldengarm.com/index.php/2016/10/17/angular-2-automated-i18n-workflow-using-gulp/)
* [XLIFF Spec](http://docs.oasis-open.org/xliff/xliff-core/xliff-core.html)
* XLIFF Specification: [XLIFF Spec](http://docs.oasis-open.org/xliff/xliff-core/xliff-core.html)
* My Tiny Translator Tool: [TinyTranslator](https://github.com/martinroob/tiny-translator)

@@ -188,0 +211,0 @@ [travis-badge]: https://travis-ci.org/martinroob/ngx-i18nsupport.svg?branch=master

@@ -54,3 +54,3 @@ /**

*/
useSourceAsTarget(isDefaultLang: boolean);
useSourceAsTarget(isDefaultLang: boolean, copyContent: boolean);

@@ -57,0 +57,0 @@ /**

@@ -86,3 +86,3 @@ import {XliffFile} from './xliff-file';

*/
useSourceAsTarget(transUnit: ITransUnit, isDefaultLang: boolean);
useSourceAsTarget(transUnit: ITransUnit, isDefaultLang: boolean, copyContent: boolean);

@@ -112,2 +112,2 @@ /**

}
}

@@ -39,3 +39,4 @@ /**

supportNgxTranslate?: boolean; // Flag, wether output for ngs-translate should be generated
useSourceAsTarget?: boolean; // Flag, whether source must be used as target for new trans-units
}

@@ -131,10 +131,14 @@ import * as cheerio from "cheerio";

*/
public useSourceAsTarget(isDefaultLang: boolean) {
public useSourceAsTarget(isDefaultLang: boolean, copyContent: boolean) {
let source = cheerio('source', this._transUnit);
let target = cheerio('target', this._transUnit);
if (!target) {
source.parent().append('<target/>');
source.parent().append('<target/>');
target = cheerio('target', source.parent());
}
target.html(source.html());
if (isDefaultLang || copyContent) {
target.html(source.html());
} else {
target.html('');
}
if (isDefaultLang) {

@@ -268,4 +272,4 @@ target.attr('state', 'final');

*/
public useSourceAsTarget(transUnit: ITransUnit, isDefaultLang: boolean) {
transUnit.useSourceAsTarget(isDefaultLang);
public useSourceAsTarget(transUnit: ITransUnit, isDefaultLang: boolean, copyContent: boolean) {
transUnit.useSourceAsTarget(isDefaultLang, copyContent);
}

@@ -324,2 +328,2 @@

}
}

@@ -27,2 +27,3 @@ /**

private _supportNgxTranslate: boolean;
private _useSourceAsTarget: boolean;

@@ -146,2 +147,5 @@ public errorsFound: XliffMergeError[];

}
if (!isNullOrUndefined(profile.useSourceAsTarget)) {
this._useSourceAsTarget = profile.useSourceAsTarget;
}
} else {

@@ -230,2 +234,3 @@ this.warningsFound.push('did not find "xliffmergeOptions" in profile, using defaults');

commandOutput.debug('supportNgxTranslate:\t%s', this.supportNgxTranslate());
commandOutput.debug('useSourceAsTarget:\t%s', this.useSourceAsTarget());
}

@@ -316,2 +321,10 @@

}
}
/**
* Whether source must be used as target for new trans-units
* Default is true
*/
public useSourceAsTarget(): boolean {
return (isNullOrUndefined(this._useSourceAsTarget)) ? true : this._useSourceAsTarget;
}
}

@@ -303,3 +303,4 @@ import fs = require("fs");

genDir: WORKDIR,
i18nFile: MASTERFILE
i18nFile: MASTERFILE,
useSourceAsTarget: false
}

@@ -352,2 +353,35 @@ };

it('should generate translated file for all languages with empty targets for non default languages', (done) => {
FileUtil.copy(MASTER1SRC, MASTER);
let ws: WriterToString = new WriterToString();
let commandOut = new CommandOutput(ws);
let profileContent: IConfigFile = {
xliffmergeOptions: {
defaultLanguage: 'de',
srcDir: WORKDIR,
genDir: WORKDIR,
i18nFile: MASTERFILE,
useSourceAsTarget: false
}
};
let xliffMergeCmd = XliffMerge.createFromOptions(commandOut, {languages: ['de', 'en']}, profileContent);
xliffMergeCmd.run();
expect(ws.writtenData()).not.toContain('ERROR');
let langFileGerman: XliffFile = readXliff(xliffMergeCmd.generatedI18nFile('de'));
expect(langFileGerman.sourceLanguage()).toBe('de');
expect(langFileGerman.targetLanguage()).toBe('de');
langFileGerman.forEachTransUnit((tu: ITransUnit) => {
expect(tu.targetContent()).toBe(tu.sourceContent());
expect(tu.targetState()).toBe('final');
});
let langFileEnglish: XliffFile = readXliff(xliffMergeCmd.generatedI18nFile('en'));
expect(langFileEnglish.sourceLanguage()).toBe('de');
expect(langFileEnglish.targetLanguage()).toBe('en');
langFileEnglish.forEachTransUnit((tu: ITransUnit) => {
expect(tu.targetContent()).toBe('');
expect(tu.targetState()).toBe('new');
});
done();
});
it('should merge translated file for all languages', (done) => {

@@ -354,0 +388,0 @@ FileUtil.copy(MASTER1SRC, MASTER);

@@ -213,6 +213,6 @@ import * as program from 'commander';

// copy source to target
// copy source to target if necessary
let isDefaultLang: boolean = (lang == this.parameters.defaultLanguage());
languageSpecificMessagesFile.forEachTransUnit((transUnit: ITransUnit) => {
languageSpecificMessagesFile.useSourceAsTarget(transUnit, isDefaultLang);
languageSpecificMessagesFile.useSourceAsTarget(transUnit, isDefaultLang, this.parameters.useSourceAsTarget());
});

@@ -242,3 +242,3 @@ // write it to file

// oops, no translation, must be a new key, so add it
languageSpecificMessagesFile.useSourceAsTarget(masterTransUnit, isDefaultLang);
languageSpecificMessagesFile.useSourceAsTarget(masterTransUnit, isDefaultLang, this.parameters.useSourceAsTarget());
languageSpecificMessagesFile.addNewTransUnit(masterTransUnit);

@@ -284,2 +284,2 @@ newCount++;

}
}

@@ -105,3 +105,3 @@ import * as cheerio from "cheerio";

*/
public useSourceAsTarget(isDefaultLang: boolean) {
public useSourceAsTarget(isDefaultLang: boolean, copyContent: boolean) {
}

@@ -245,4 +245,4 @@

*/
public useSourceAsTarget(transUnit: ITransUnit, isDefaultLang: boolean) {
transUnit.useSourceAsTarget(isDefaultLang);
public useSourceAsTarget(transUnit: ITransUnit, isDefaultLang: boolean, copyContent: boolean) {
transUnit.useSourceAsTarget(isDefaultLang, copyContent);
}

@@ -301,2 +301,2 @@

}
}

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc