i18next-scanner
Advanced tools
Comparing version 2.1.1 to 2.1.2
@@ -42,10 +42,20 @@ 'use strict'; | ||
var m = jsExpr.exec(txt); | ||
var addText = function addText(txt) { | ||
var lastNode = stack[0].childNodes.slice(-1)[0]; | ||
if (lastNode && lastNode.nodeName === '#text') { | ||
lastNode.value += txt; | ||
} else { | ||
stack[0].childNodes.push({ | ||
nodeName: '#text', | ||
value: txt, | ||
childNodes: [] | ||
}); | ||
} | ||
}; | ||
if (m) { | ||
while (m = jsExpr.exec(txt)) { | ||
if (m[1]) { | ||
stack[0].childNodes.push({ | ||
nodeName: '#text', | ||
value: m[1], | ||
childNodes: [] | ||
}); | ||
addText(m[1]); | ||
} | ||
@@ -61,7 +71,3 @@ stack[0].childNodes.push({ | ||
if (txt) { | ||
stack[0].childNodes.push({ | ||
nodeName: '#text', | ||
value: txt, | ||
childNodes: [] | ||
}); | ||
addText(txt); | ||
} | ||
@@ -68,0 +74,0 @@ } |
@@ -704,2 +704,11 @@ 'use strict'; | ||
_this3.log('i18next-scanner: Added a new translation key { ' + _chalk2.default.yellow(JSON.stringify(resKey)) + ': ' + _chalk2.default.yellow(JSON.stringify(resLoad[resKey])) + ' } to ' + _chalk2.default.yellow(JSON.stringify(_this3.formatResourceLoadPath(lng, ns)))); | ||
} else if (options.defaultValue) { | ||
if (!resLoad[resKey]) { | ||
// Use `options.defaultValue` if specified | ||
resLoad[resKey] = options.defaultValue; | ||
} else if (resLoad[resKey] !== options.defaultValue) { | ||
// We already had a different default. | ||
var k = _chalk2.default.yellow(JSON.stringify(resKey)); | ||
_this3.log('i18next-scanner: Translation key ' + k + ' has multiple different default values. Using first default'); | ||
} | ||
} | ||
@@ -706,0 +715,0 @@ |
{ | ||
"name": "i18next-scanner", | ||
"version": "2.1.1", | ||
"version": "2.1.2", | ||
"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", |
@@ -93,2 +93,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) | ||
_Note: Globbing patterns should be wrapped in single quotes._ | ||
#### Examples | ||
@@ -95,0 +97,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
66522
11
956
703