Security News
New Python Packaging Proposal Aims to Solve Phantom Dependency Problem with SBOMs
PEP 770 proposes adding SBOM support to Python packages to improve transparency and catch hidden non-Python dependencies that security tools often miss.
i18n-validate
Advanced tools
A cli tool to find invalid i18n keys, missing variables and many more
npx i18n-validate
Usage: cli [options] <file ...>
Options:
-V, --version output the version number
-c, --config <config> Path to the config file (default:
"./i18n-validate.json")
--log-level <logLevel> Log level
--exclude <exclude...> Exclude files from parsing
--exit-on-error Exit immediately if an error is found
-h, --help display help for command
Examples:
$ i18next-validate "/path/to/src/app.js"
$ i18next-validate --config i18n-validate-custom.json 'src/**/*.{js,jsx}'
$ i18next-validate --exclude "**/node_modules/**" "src/**/*.{js,jsx}"
Note: Currently,
i18n-validate
supportstypescript
andjavascript
(includingtsx
andjsx
) source files andjson
translation files only.
You can ignore a specific function by adding // i18n-validate-disable-next-line
comment before the function call or ignore all the functions in a file by adding /* i18n-validate-disable */
comment at the top of the file.
For dynamic keys, we check the typescript type of the key. If the type is a const
type, the type is used as the key. Otherwise, the key is ignored. Type can be an union type or a literal type.
For ts files
const a = 'namespace:key1';
t(a);
const b = `namespace:${b}` as const;
t(b);
t(`namespace:${b}` as const);
declare const c: 'namespace:key3' | 'namespace:key4';
t(c);
For js files
/**
* @type {'a:key5' | 'a:key6'}
*/
const d = `a:${b}`;
t(d);
const e = /** @type {'a:key7' | 'a:key8'} */ (`a:${b}`);
t(e);
{
"lint-staged": {
"*.{js,jsx,ts,tsx}": ["i18n-validate"]
}
}
You can customize the behavior of i18n-validate
by adding a i18n-validate.json
file to the root of your project.
{
"$schema": "https://raw.githubusercontent.com/imranbarbhuiya/i18n-validate/main/.github/i18n-validate.schema.json"
}
Note: You can also use
js
,cjs
ormjs
file and with any name you want. Just make sure to pass the path of the config file toi18n-validate
using--config
option.
/**
* @type {import('i18n-validate').Options}
*/
module.exports = {
// ...
};
If you want to support me by donating, you can do so by using any of the following methods. Thank you very much in advance!
Thanks goes to these wonderful people:
FAQs
A cli tool to find invalid i18n keys, missing variables and many more
We found that i18n-validate demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
PEP 770 proposes adding SBOM support to Python packages to improve transparency and catch hidden non-Python dependencies that security tools often miss.
Security News
Socket CEO Feross Aboukhadijeh discusses open source security challenges, including zero-day attacks and supply chain risks, on the Cyber Security Council podcast.
Security News
Research
Socket researchers uncover how threat actors weaponize Out-of-Band Application Security Testing (OAST) techniques across the npm, PyPI, and RubyGems ecosystems to exfiltrate sensitive data.