'i18next-parser skips keys on general extraction
I am working with React and Typescript, using the i18n and i18next modules for translations. I wanted to extract the keys for these translations with i18next-parser, and I have done so by using the i18next -c i18next-parser.config.jscommand. The problem is that, although this command does detect all the keys, it does not extract and write all of them to the output file.
This is the outcome of the extraction:
Unique keys: 221 (221 with plurals)
Added keys: 221
Restored keys: 0
Removed keys: 0
But only 50 words are written to the file.
I have checked that this is not due to repetition of keys nor malformed translation tokens. In fact, if rather than doing one extraction with the general path "src/**/*.{js,jsx,ts,tsx}" I undertake several extractions using less general ones, I end up having a 189 key file, where there are no keys missing.
Therefore, I would like to know if there is anything configuration wise to change for allowing the extraction to write all the keys in a project with only one extraction using the path "src/**/*.{js,jsx,ts,tsx}".
Here is my configuration file:
// i18next-parser.config.js
module.exports = {
contextSeparator: '_',
createOldCatalogs: false,
defaultNamespace: 'translation',
defaultValue: '',
indentation: 2,
keepRemoved: false,
keySeparator: false,
lexers: {
ts: [{ lexer: "JavascriptLexer" }],
tsx: [{ lexer: "JsxLexer" }],
js: [{ lexer: "JavascriptLexer" }],
jsx: [{ lexer: "JsxLexer" }],
default: ["JavascriptLexer"],
},
locales: ['en','fr'],
namespaceSeparator: false,
output: 'src/public/locales/$LOCALE.json',
pluralSeparator: false,
input: ['src/**/*.{js,jsx,ts,tsx}', 'src/*.{js,jsx,ts,tsx}'],
sort: false,
skipDefaultValues: false,
useKeysAsDefaultValue: true,
verbose: true,
failOnWarnings: false,
failOnUpdate: false,
customValueTemplate: null,
resetDefaultValueLocale: null,
i18nextOptions: null
}
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
