{"id":20428226,"url":"https://github.com/imranbarbhuiya/i18n-validate","last_synced_at":"2025-04-12T19:22:53.999Z","repository":{"id":181365914,"uuid":"666667034","full_name":"imranbarbhuiya/i18n-validate","owner":"imranbarbhuiya","description":"A cli tool to find invalid i18n keys, missing variables and many more.","archived":false,"fork":false,"pushed_at":"2025-04-11T21:09:16.000Z","size":9740,"stargazers_count":10,"open_issues_count":11,"forks_count":1,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-04-11T22:25:12.135Z","etag":null,"topics":["hacktoberfest"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/imranbarbhuiya.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":".github/CODEOWNERS","security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"github":["imranbarbhuiya"]}},"created_at":"2023-07-15T07:02:24.000Z","updated_at":"2025-04-11T21:09:17.000Z","dependencies_parsed_at":"2023-07-15T07:31:21.749Z","dependency_job_id":"cd04fb8f-5420-4434-9918-317419c3967f","html_url":"https://github.com/imranbarbhuiya/i18n-validate","commit_stats":null,"previous_names":["imranbarbhuiya/i18n-validate"],"tags_count":11,"template":false,"template_full_name":"imranbarbhuiya/package-template","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/imranbarbhuiya%2Fi18n-validate","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/imranbarbhuiya%2Fi18n-validate/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/imranbarbhuiya%2Fi18n-validate/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/imranbarbhuiya%2Fi18n-validate/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/imranbarbhuiya","download_url":"https://codeload.github.com/imranbarbhuiya/i18n-validate/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248488753,"owners_count":21112426,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["hacktoberfest"],"created_at":"2024-11-15T07:24:43.291Z","updated_at":"2025-04-12T19:22:53.982Z","avatar_url":"https://github.com/imranbarbhuiya.png","language":"TypeScript","funding_links":["https://github.com/sponsors/imranbarbhuiya","https://www.buymeacoffee.com/parbez","https://ko-fi.com/Y8Y1CBIJH'"],"categories":[],"sub_categories":[],"readme":"\u003cdiv align=\"center\"\u003e\n\n# i18n-validate\n\n**A cli tool to find invalid i18n keys, missing variables and many more.**\n\n## Packages\n\n[![npm](https://img.shields.io/npm/v/i18n-validate?color=crimson\u0026logo=npm\u0026style=flat-square)](https://www.npmjs.com/package/i18n-validate)\n[![npm-i18n-validate](https://img.shields.io/npm/dw/i18n-validate)](https://www.npmjs.com/package/i18n-validate)\n\n\u003c/div\u003e\n\n## Features\n\n- Written In Typescript\n- Offers CLI and API\n- Full TypeScript \u0026 JavaScript support\n- Framework agnostic\n- Supports Pluralization\n- Fully customizable\n- Supports dynamic keys using typescript const types\n\n## Usage\n\n```sh\nnpx i18n-validate\n```\n\n\u003c!-- prettier-ignore-start --\u003e\n```sh\nUsage: cli [options] \u003cfile ...\u003e\n\nOptions:\n  -V, --version           output the version number\n  -c, --config \u003cconfig\u003e   Path to the config file (default:\n                          \"./i18n-validate.json\")\n  --log-level \u003clogLevel\u003e  Log level\n  --exclude \u003cexclude...\u003e  Exclude files from parsing\n  --exit-on-error         Exit immediately if an error is found\n  -h, --help              display help for command\n\n  Examples:\n\n    $ i18next-validate \"/path/to/src/app.js\"\n    $ i18next-validate --config i18n-validate-custom.json 'src/**/*.{js,jsx}'\n    $ i18next-validate --exclude \"**/node_modules/**\" \"src/**/*.{js,jsx}\"\n\n```\n\u003c!-- prettier-ignore-end --\u003e\n\n\u003e **Note**: Currently, `i18n-validate` supports `typescript` and `javascript` (including `tsx` and `jsx`) source files and `json` translation files only.\n\n### Ignoring function or file\n\nYou 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.\n\n### Dynamic keys\n\nFor 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.\n\nFor ts files\n\n```ts\nconst a = 'namespace:key1';\n\nt(a);\n\nconst b = `namespace:${b}` as const;\n\nt(b);\n\nt(`namespace:${b}` as const);\n\ndeclare const c: 'namespace:key3' | 'namespace:key4';\n\nt(c);\n```\n\nFor js files\n\n```js\n/**\n * @type {'a:key5' | 'a:key6'}\n */\nconst d = `a:${b}`;\n\nt(d);\n\nconst e = /** @type {'a:key7' | 'a:key8'} */ (`a:${b}`);\n\nt(e);\n```\n\n### Use with lint-staged\n\n```json\n{\n\t\"lint-staged\": {\n\t\t\"*.{js,jsx,ts,tsx}\": [\"i18n-validate\"]\n\t}\n}\n```\n\n## Configuration\n\nYou can customize the behavior of `i18n-validate` by adding a `i18n-validate.json` file to the root of your project.\n\n```json\n{\n\t\"$schema\": \"https://raw.githubusercontent.com/imranbarbhuiya/i18n-validate/main/.github/i18n-validate.schema.json\"\n}\n```\n\n\u003e **Note**: You can also use `js`, `cjs` or `mjs` file and with any name you want. Just make sure to pass the path of the config file to `i18n-validate` using `--config` option.\n\n```js\n/**\n * @type {import('i18n-validate').Options}\n */\nmodule.exports = {\n\t// ...\n};\n```\n\n## Buy me some doughnuts\n\nIf you want to support me by donating, you can do so by using any of the following methods. Thank you very much in advance!\n\n\u003ca href=\"https://github.com/sponsors/imranbarbhuiya\" target=\"_blank\"\u003e\u003cimg src=\"https://img.shields.io/static/v1?label=Sponsor\u0026message=%E2%9D%A4\u0026logo=GitHub\u0026color=%23fe8e86\" alt=\"Buy Me A Coffee\" height=\"41\" width=\"174\"\u003e\u003c/a\u003e\n\u003ca href=\"https://www.buymeacoffee.com/parbez\" target=\"_blank\"\u003e\u003cimg src=\"https://cdn.buymeacoffee.com/buttons/default-orange.png\" alt=\"Buy Me A Coffee\" height=\"41\" width=\"174\"\u003e\u003c/a\u003e\n\u003ca href='https://ko-fi.com/Y8Y1CBIJH' target='_blank'\u003e\u003cimg height='36' style='border:0px;height:36px;' src='https://cdn.ko-fi.com/cdn/kofi4.png?v=3' border='0' alt='Buy Me a Coffee at ko-fi.com' /\u003e\u003c/a\u003e\n\n## TODO\n\n- [ ] Write unit tests\n- [ ] Add support for `yaml`, `json5` translation files\n- [ ] Add support for other framework specific source files (e.g. `vue`, `svelte`, `angular` etc.)\n- [ ] Detect unused translation keys\n- [ ] A vscode extension\n- [ ] A github action\n- [ ] An eslint plugin\n- [ ] A `--fix` flag to remove unused keys and variables\n\n_Any help to complete these tasks will be highly appreciated._\n\n## Contributors ✨\n\nThanks goes to these wonderful people:\n\n\u003ca href=\"https://github.com/imranbarbhuiya/i18n-validate/graphs/contributors\"\u003e\n    \u003cimg src=\"https://contrib.rocks/image?repo=imranbarbhuiya/i18n-validate\" /\u003e\n\u003c/a\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fimranbarbhuiya%2Fi18n-validate","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fimranbarbhuiya%2Fi18n-validate","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fimranbarbhuiya%2Fi18n-validate/lists"}