i18next-parser
Advanced tools
Comparing version 1.0.0-beta17 to 1.0.0-beta18
# Changelog | ||
## 1.0.0-beta17 - latest | ||
## 1.0.0-beta - latest | ||
@@ -5,0 +5,0 @@ - The changelog for the beta can be found in the [releases](https://github.com/i18next/i18next-parser/releases) |
@@ -202,6 +202,6 @@ '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'); | ||
} else | ||
if (lineEnding === '\r\n' || lineEnding === 'crlf') { | ||
if (this.options.lineEnding === '\r\n' || this.options.lineEnding === 'crlf') { | ||
text = _eol2.default.crlf(text); | ||
} else | ||
if (lineEnding === '\r' || lineEnding === 'cr') { | ||
if (this.options.lineEnding === '\r' || this.options.lineEnding === 'cr') { | ||
text = _eol2.default.cr(text); | ||
@@ -208,0 +208,0 @@ } else |
@@ -5,3 +5,3 @@ { | ||
"name": "i18next-parser", | ||
"version": "1.0.0-beta17", | ||
"version": "1.0.0-beta18", | ||
"license": "MIT", | ||
@@ -8,0 +8,0 @@ "main": "dist/index.js", |
@@ -5,4 +5,5 @@ # i18next Parser [![Build Status](https://travis-ci.org/i18next/i18next-parser.svg?branch=master)](https://travis-ci.org/i18next/i18next-parser) | ||
When translating an application, maintaining the translation catalog by hand is painful. This package automates this process. | ||
When translating an application, maintaining the translation catalog by hand is painful. This package parses your code and automates this process. | ||
If you want to make this process even less painful, I invite you to check [Locize](https://locize.com/). And if you use this package and like it, supporting me on [Patreon](https://www.patreon.com/karelledru) would mean a great deal! (disclamer: Locize is supporting this project on Patreon). | ||
@@ -9,0 +10,0 @@ |
@@ -202,6 +202,6 @@ import { dotPathToHash, mergeHashes, populateHash } from './helpers' | ||
} | ||
else if (lineEnding === '\r\n' || lineEnding === 'crlf') { | ||
else if (this.options.lineEnding === '\r\n' || this.options.lineEnding === 'crlf') { | ||
text = eol.crlf(text) | ||
} | ||
else if (lineEnding === '\r' || lineEnding === 'cr') { | ||
else if (this.options.lineEnding === '\r' || this.options.lineEnding === 'cr') { | ||
text = eol.cr(text) | ||
@@ -208,0 +208,0 @@ } |
@@ -565,2 +565,25 @@ import { assert } from 'chai' | ||
it('supports a lineEnding', (done) => { | ||
let result | ||
const i18nextParser = new i18nTransform({ | ||
lineEnding: '\r\n' | ||
}) | ||
const fakeFile = new Vinyl({ | ||
contents: Buffer.from("t('first')"), | ||
path: 'file.js' | ||
}) | ||
i18nextParser.on('data', file => { | ||
if (file.relative.endsWith(enLibraryPath)) { | ||
result = file.contents.toString() | ||
} | ||
}) | ||
i18nextParser.once('end', () => { | ||
assert.equal(result, '{\r\n "first": ""\r\n}\r\n') | ||
done() | ||
}) | ||
i18nextParser.end(fakeFile) | ||
}) | ||
it('parses Trans if reactNamespace is true', (done) => { | ||
@@ -567,0 +590,0 @@ let result |
431414
3446
214