i18next-scanner
Advanced tools
Comparing version 1.9.0 to 1.9.1
@@ -326,2 +326,6 @@ 'use strict'; | ||
options[prop.key.name] = prop.value.value; | ||
} else if (prop.value.type === 'TemplateLiteral') { | ||
options[prop.key.name] = prop.value.quasis.map(function (element) { | ||
return element.value.cooked; | ||
}).join(''); | ||
} else { | ||
@@ -328,0 +332,0 @@ // Unable to get value of the property |
{ | ||
"name": "i18next-scanner", | ||
"version": "1.9.0", | ||
"version": "1.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", |
@@ -288,2 +288,6 @@ /* eslint no-console: 0 */ | ||
options[prop.key.name] = prop.value.value; | ||
} else if (prop.value.type === 'TemplateLiteral') { | ||
options[prop.key.name] = prop.value.quasis | ||
.map(element => element.value.cooked) | ||
.join(''); | ||
} else { | ||
@@ -290,0 +294,0 @@ // Unable to get value of the property |
@@ -528,1 +528,27 @@ import fs from 'fs'; | ||
}); | ||
test('Extract properties from template literals', (t) => { | ||
const parser = new Parser({ | ||
defaultValue: function(lng, ns, key) { | ||
if (lng === 'en') { | ||
return key; | ||
} | ||
return '__NOT_TRANSLATED__'; | ||
}, | ||
keySeparator: false, | ||
nsSeparator: false | ||
}); | ||
const content = fs.readFileSync(path.resolve(__dirname, 'fixtures/template-literals.js'), 'utf8'); | ||
const wanted = { | ||
"en": { | ||
"translation": { | ||
"property in template literals": "property in template literals", | ||
} | ||
} | ||
}; | ||
parser.parseFuncFromString(content); | ||
t.same(parser.get(), wanted); | ||
t.end(); | ||
}); |
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
119534
40
2399