Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

i18next-parser

Package Overview
Dependencies
Maintainers
1
Versions
144
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

i18next-parser - npm Package Compare versions

Comparing version 2.1.2 to 2.1.3

6

CHANGELOG.md
# Changelog
# 2.1.2 - latest
# 2.1.3 - latest
- Support unknow languages #230
# 2.1.2
- Support curly braces in jsx Trans elements #229

@@ -6,0 +10,0 @@

5

dist/transform.js

@@ -129,4 +129,5 @@ 'use strict';Object.defineProperty(exports, "__esModule", { value: true });var _extends = Object.assign || function (target) {for (var i = 1; i < arguments.length; i++) {var source = arguments[i];for (var key in source) {if (Object.prototype.hasOwnProperty.call(source, key)) {target[key] = source[key];}}}return target;};var _createClass = function () {function defineProperties(target, props) {for (var i = 0; i < props.length; i++) {var descriptor = props[i];descriptor.enumerable = descriptor.enumerable || false;descriptor.configurable = true;if ("value" in descriptor) descriptor.writable = true;Object.defineProperty(target, descriptor.key, descriptor);}}return function (Constructor, protoProps, staticProps) {if (protoProps) defineProperties(Constructor.prototype, protoProps);if (staticProps) defineProperties(Constructor, staticProps);return Constructor;};}();var _helpers = require('./helpers');

locale) {
var catalog = {};var _i18next$services$plu =
_i18next2.default.services.pluralResolver.getRule(locale),numbers = _i18next$services$plu.numbers;
var catalog = {};
var pluralRule = _i18next2.default.services.pluralResolver.getRule(locale);
var numbers = pluralRule && pluralRule.numbers || [1, 2];

@@ -133,0 +134,0 @@ var countWithPlurals = 0;

@@ -5,3 +5,3 @@ {

"name": "i18next-parser",
"version": "2.1.2",
"version": "2.1.3",
"license": "MIT",

@@ -8,0 +8,0 @@ "main": "dist/index.js",

@@ -130,3 +130,4 @@ import { dotPathToHash, mergeHashes, transferValues } from './helpers'

const catalog = {}
const { numbers } = i18next.services.pluralResolver.getRule(locale)
const pluralRule = i18next.services.pluralResolver.getRule(locale)
const numbers = (pluralRule && pluralRule.numbers) || [1, 2]

@@ -133,0 +134,0 @@ let countWithPlurals = 0

@@ -977,2 +977,28 @@ import { assert } from 'chai'

it('generates one plural key for unknow languages', (done) => {
let result
const i18nextParser = new i18nTransform({ locales: ['unknown'] })
const fakeFile = new Vinyl({
contents: Buffer.from("t('test {{count}}', { count: 1 })"),
path: 'file.js',
})
i18nextParser.on('data', (file) => {
if (
file.relative.endsWith(path.normalize('unknown/translation.json'))
) {
result = JSON.parse(file.contents)
}
})
i18nextParser.once('end', () => {
assert.deepEqual(result, {
'test {{count}}': '',
'test {{count}}_plural': '',
})
done()
})
i18nextParser.end(fakeFile)
})
it('generates plurals for languages with multiple plural forms', (done) => {

@@ -979,0 +1005,0 @@ let result

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