Socket
Socket
Sign inDemoInstall

i18next-scanner

Package Overview
Dependencies
Maintainers
1
Versions
92
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

i18next-scanner - npm Package Compare versions

Comparing version 2.2.1 to 2.3.0

29

lib/index.js

@@ -11,2 +11,6 @@ 'use strict';

var _eol = require('eol');
var _eol2 = _interopRequireDefault(_eol);
var _get = require('lodash/get');

@@ -66,4 +70,5 @@

};
};
}; /* eslint-disable no-buffer-constructor */
var flush = function flush(parser, customFlush) {

@@ -84,3 +89,6 @@ return function _flush(done) {

var resStore = parser.get({ sort: options.sort });
var jsonIndent = options.resource.jsonIndent;
var lineEnding = String(options.resource.lineEnding).toLowerCase();
Object.keys(resStore).forEach(function (lng) {

@@ -92,7 +100,20 @@ var namespaces = resStore[lng];

var resPath = parser.formatResourceSavePath(lng, ns);
var str = JSON.stringify(obj, null, options.resource.jsonIndent);
var text = JSON.stringify(obj, null, jsonIndent) + '\n';
if (lineEnding === 'auto') {
text = _eol2.default.auto(text);
} else if (lineEnding === '\r\n' || lineEnding === 'crlf') {
text = _eol2.default.crlf(text);
} else if (lineEnding === '\n' || lineEnding === 'lf') {
text = _eol2.default.lf(text);
} else if (lineEnding === '\r' || lineEnding === 'cr') {
text = _eol2.default.cr(text);
} else {
// Defaults to LF
text = _eol2.default.lf(text);
}
_this.push(new _vinyl2.default({
path: resPath,
contents: new Buffer(str + '\n')
contents: typeof Buffer.from === 'function' ? Buffer.from(text) : new Buffer(text) // new Buffer() is deprecated since Node.js v5
}));

@@ -117,3 +138,3 @@ });

// Convinience API
// Convenience API
module.exports = function () {

@@ -120,0 +141,0 @@ var _module$exports;

@@ -80,5 +80,14 @@ 'use strict';

resource: {
loadPath: 'i18n/{{lng}}/{{ns}}.json', // the source resource path (relative to current working directory)
savePath: 'i18n/{{lng}}/{{ns}}.json', // the target resource path (relative to the path specified with `gulp.dest(path)`)
jsonIndent: 2
// The path where resources get loaded from. Relative to current working directory.
loadPath: 'i18n/{{lng}}/{{ns}}.json',
// The path to store resources. Relative to the path specified by `gulp.dest(path)`.
savePath: 'i18n/{{lng}}/{{ns}}.json',
// Specify the number of space characters to use as white space to insert into the output JSON string for readability purpose.
jsonIndent: 2,
// Normalize line endings to '\r\n', '\r', '\n', or 'auto' for the current operating system. Defaults to '\n'.
// Aliases: 'CRLF', 'CR', 'LF', 'crlf', 'cr', 'lf'
lineEnding: '\n'
},

@@ -187,2 +196,5 @@

}
if (_lodash2.default.isUndefined(_lodash2.default.get(options, 'resource.lineEnding'))) {
_lodash2.default.set(options, 'resource.lineEnding', defaults.resource.lineEnding);
}

@@ -189,0 +201,0 @@ // Accept both nsseparator or nsSeparator

21

package.json
{
"name": "i18next-scanner",
"version": "2.2.1",
"version": "2.3.0",
"description": "Scan your code, extract translation keys/values, and merge them into i18n resource files.",

@@ -51,3 +51,4 @@ "homepage": "https://github.com/i18next/i18next-scanner",

"chalk": "^2.3.0",
"commander": "^2.11.0",
"commander": "^2.13.0",
"eol": "^0.9.1",
"esprima": "^4.0.0",

@@ -61,3 +62,3 @@ "gulp-sort": "^2.0.0",

"vinyl": "^2.1.0",
"vinyl-fs": "^2.4.4"
"vinyl-fs": "^3.0.1"
},

@@ -67,11 +68,11 @@ "devDependencies": {

"babel-core": "^6.26.0",
"babel-eslint": "^8.0.2",
"babel-eslint": "^8.2.1",
"babel-preset-es2015": "^6.24.1",
"babel-preset-stage-0": "^6.24.1",
"coveralls": "^2.13.1",
"eslint": "^4.10.0",
"eslint-config-trendmicro": "^1.1.0",
"coveralls": "^3.0.0",
"eslint": "^4.15.0",
"eslint-config-trendmicro": "^1.3.0",
"eslint-plugin-import": "^2.8.0",
"eslint-plugin-jsx-a11y": "^5.1.1",
"eslint-plugin-react": "^7.4.0",
"eslint-plugin-jsx-a11y": "^6.0.3",
"eslint-plugin-react": "^7.5.1",
"gulp": "^3.9.1",

@@ -81,5 +82,5 @@ "gulp-tap": "^1.0.1",

"sha1": "^1.1.1",
"tap": "^10.7.2",
"tap": "^11.0.1",
"text-table": "^0.2.0"
}
}

@@ -490,2 +490,4 @@ # i18next-scanner [![build status](https://travis-ci.org/i18next/i18next-scanner.svg?branch=master)](https://travis-ci.org/i18next/i18next-scanner) [![Coverage Status](https://coveralls.io/repos/i18next/i18next-scanner/badge.svg?branch=master&service=github)](https://coveralls.io/github/i18next/i18next-scanner?branch=master)

savePath: 'i18n/{{lng}}/{{ns}}.json',
jsonIndent: 2,
lineEnding: '\n'
},

@@ -497,3 +499,3 @@ nsSeparator: ':',

interpolation: {
pefix: '{{',
prefix: '{{',
suffix: '}}'

@@ -622,10 +624,14 @@ }

resource: {
// path where resources get loaded from
// The path where resources get loaded from. Relative to current working directory.
loadPath: 'i18n/{{lng}}/{{ns}}.json',
// path to store resources
// The path to store resources. Relative to the path specified by `gulp.dest(path)`.
savePath: 'i18n/{{lng}}/{{ns}}.json',
// jsonIndent to use when storing json files
jsonIndent: 2
// Specify the number of space characters to use as white space to insert into the output JSON string for readability purpose.
jsonIndent: 2,
// Normalize line endings to '\r\n', '\r', '\n', or 'auto' for the current operating system. Defaults to '\n'.
// Aliases: 'CRLF', 'CR', 'LF', 'crlf', 'cr', 'lf'
lineEnding: '\n'
}

@@ -632,0 +638,0 @@ }

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