Package Exports
- @hi18n/cli
Readme
Command line tool for hi18n
See hi18n's README for general information.
hi18n sync
hi18n sync <...files> --ignore <glob>Synchronizes unused and missing translations.
Configuration
Configuration is loaded via cosmiconfig. Cosmiconfig's documentation explains a lot, but in short, it reads:
hi18nproperty inpackage.json.hi18nrc.hi18nrc.json.hi18nrc.yaml.hi18nrc.yml.hi18nrc.js.hi18nrc.cjshi18n.config.jshi18n.config.cjs
parser and parserOptions
// .hi18nrc.js
module.exports = {
parser: "@typescript-eslint/parser",
parserOptions: {
ecmaVersion: 2022,
sourceType: "module",
ecmaFeatures: {
jsx: true,
},
},
};These configurations resemble those in ESLint. See ESLint's docs for details.
Default:
{
parser: "@babel/eslint-parser",
parserOptions: {
ecmaVersion: "latest",
sourceType: "module",
},
}extensions
// .hi18nrc.js
module.exports = {
extensions: ["...", ".mjsx", ".cjsx"],
};Configures extensions to resolve. ... will be expanded to the default list.
Default: .js, .cjs, .mjs, .ts, .cts, .mts, .jsx, .tsx
extensionsToRemove
// .hi18nrc.js
module.exports = {
extensions: ["...", ".json"],
};Configures extensions to remove before resolving paths. ... will be expanded to the default list.
Default: .js, .cjs, .mjs
baseUrl
// .hi18nrc.js
module.exports = {
baseUrl: ".",
};Maps the specified directory to the virtual root of the package tree.
It resembles the behavior of tsconfig's baseUrl.
Default: undefined, meaning paths such as jquery will be only searched for in node_modules.
paths
// .hi18nrc.js
module.exports = {
baseUrl: ".",
paths: {
"@/*": ["src/components/*"],
},
};Configures path mapping. Requires baseUrl to be set.
It resembles the behavior of tsconfig's paths.