-
-
Notifications
You must be signed in to change notification settings - Fork 129
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Missing script i18next-scanner #152
Comments
|
okay i tried using i18next-scanner --config i18next-scanner.config.js 'src/**/*.{js,jsx} doesn't work as well. what is the command to run it. thanks |
got it working. path to the file was wrong. |
I have similar problem. Even my path to config file is correct. Can someone help to redirect me to a tutorial which contains end to end usage of i18next-scanner |
Hi all, i don't what happen with "chalk" it seems to be a library that provides you methods for displaying text in colour in a terminal interface alike, I don't know.. but I do remove it from the config file and then remove the references (it was used for looging issues, so no core functionally is beign touched), and it works. I leave you the config file that works for me
|
this also provides another config file that works: https://lightrun.com/answers/i18next-i18next-scanner-support-for-react-i18next-namespaces. I will start to wonder if this project is actually manned by someone. |
Hi, i have recently added react-i18next for translating react application. In order to extract translations using i18next-scanner. To do so,
i installed the i18next-scanner and add the configuration to the i18next-scanner.config.js file like below,
/* eslint no-console: 0 /
/ eslint strict: 0 */
const fs = require('fs');
const chalk = require('chalk');
const languages = [
'en', // English (default)
];
module.exports = {
src: [
'app//*.{html,js,jsx}',
// Use ! to filter out files or directories
'!app//*.spec.{js,jsx}',
'!app/i18n/',
'!test/',
'!/node_modules/'
],
dest: './',
options: {
debug: false,
removeUnusedKeys: true,
sort: false,
lngs: languages,
func: {
list: [], // Use an empty array to bypass the default list: i18n.t, i18next.t
extensions: ['.js', '.jsx']
},
trans: {
component: 'I18n',
i18nKey: 'i18nKey',
extensions: ['.js', '.jsx'],
fallbackKey: function(ns, value) {
return value;
}
},
defaultValue: (lng, ns, key) => {
if (lng === 'en') {
return key; // Use key as value for base language
}
return ''; // Return empty string for other languages
},
ns: [
'resource' // default
],
defaultNs: 'resource',
resource: {
loadPath: 'app/i18n/{{lng}}/{{ns}}.json',
savePath: 'app/i18n/{{lng}}/{{ns}}.json', // or 'app/i18n/${lng}/${ns}.saveAll.json'
jsonIndent: 4
},
nsSeparator: ':', // namespace separator
keySeparator: '.', // key separator
plural: false, // No plural form keys
interpolation: {
prefix: '{{',
suffix: '}}'
}
},
transform: function(file, enc, done) {
'use strict';
};
And from command line executed npm run i18next-scanner --config i18next-scanner.config.js 'src/**/*.{js,jsx}' but it throws error missing script i18next-scanner.
Not sure why i get this error. Could you point me to some tutorial that explains how to configure react- i18next-scanner to react-i18next.
Thanks.
The text was updated successfully, but these errors were encountered: