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.9.0 to 2.9.1

lib/ensure-array.js

40

lib/parser.js

@@ -256,6 +256,6 @@ 'use strict';

// Get an array of plurals suffixes for a given language.
// Get an array of plural suffixes for a given language.
// @param {string} lng The language.
// @param {string} pluralSeparator pluralSeparator, default '_'.
// @return {array|boolean} Return array of suffixes of false if lng is not supported.
// @return {array} An array of plural suffixes.
var getPluralSuffixes = function getPluralSuffixes(lng) {

@@ -266,19 +266,18 @@ var pluralSeparator = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '_';

var suffixes = [];
if (!(rule && rule.numbers)) {
return []; // Return an empty array if lng is not supported
}
if (!rule) {
return false;
} else if (rule.numbers.length === 2) {
suffixes = ['', pluralSeparator + 'plural'];
} else {
var res = [];
suffixes = rule.numbers.reduce(function (red, n, i) {
if (rule.numbers.length === 1) {
return [pluralSeparator + '0'];
}
res.push('' + pluralSeparator + i);
return res;
}, '');
if (rule.numbers.length === 1) {
return [pluralSeparator + '0'];
}
if (rule.numbers.length === 2) {
return ['', pluralSeparator + 'plural'];
}
var suffixes = rule.numbers.reduce(function (acc, n, i) {
return acc.concat('' + pluralSeparator + i);
}, []);
return suffixes;

@@ -313,7 +312,8 @@ };

_this.resScan[lng] = _this.resScan[lng] || {};
_this.pluralSuffixes[lng] = getPluralSuffixes(lng, _this.options.pluralSeparator);
if (!_this.pluralSuffixes[lng]) {
_this.log('i18next-scanner: Unexpected language ' + lng);
return;
_this.pluralSuffixes[lng] = (0, _ensureArray2.default)(getPluralSuffixes(lng, _this.options.pluralSeparator));
if (_this.pluralSuffixes[lng].length === 0) {
_this.log('i18next-scanner: No plural rule found for: ' + lng);
}
namespaces.forEach(function (ns) {

@@ -320,0 +320,0 @@ var resPath = _this.formatResourceLoadPath(lng, ns);

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

@@ -5,0 +5,0 @@ "homepage": "https://github.com/i18next/i18next-scanner",

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