{"id":17936529,"url":"https://github.com/romanrostislavovich/ngx-translate-lint","last_synced_at":"2026-03-04T16:31:28.939Z","repository":{"id":45061149,"uuid":"188069837","full_name":"romanrostislavovich/ngx-translate-lint","owner":"romanrostislavovich","description":"Simple CLI tools for check `ngx-translate` keys","archived":false,"fork":false,"pushed_at":"2025-12-18T10:33:32.000Z","size":962,"stargazers_count":34,"open_issues_count":7,"forks_count":10,"subscribers_count":1,"default_branch":"develop","last_synced_at":"2025-12-21T00:37:39.813Z","etag":null,"topics":["angular","checker","cli","hacktoberfest","lint","linting","ngx-translate","translate","typescript","validator"],"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/romanrostislavovich.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":".github/CONTRIBUTING.md","funding":".github/FUNDING.yml","license":"LICENSE.md","code_of_conduct":".github/CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null},"funding":{"github":["romanrostislavovich"],"patreon":null,"open_collective":null,"ko_fi":null,"tidelift":"npm/ngx-translate-lint","community_bridge":null,"liberapay":null,"issuehunt":null,"otechie":null,"lfx_crowdfunding":null,"custom":null}},"created_at":"2019-05-22T15:51:12.000Z","updated_at":"2025-12-17T12:05:08.000Z","dependencies_parsed_at":"2025-04-13T00:09:19.232Z","dependency_job_id":"bf227017-97e8-4287-af5c-a9153531e041","html_url":"https://github.com/romanrostislavovich/ngx-translate-lint","commit_stats":null,"previous_names":["itekaf/ngx-translate-lint","svoboda-rabstvo/ngx-translate-lint","romanrostislavovich/ngx-translate-lint"],"tags_count":60,"template":false,"template_full_name":null,"purl":"pkg:github/romanrostislavovich/ngx-translate-lint","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/romanrostislavovich%2Fngx-translate-lint","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/romanrostislavovich%2Fngx-translate-lint/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/romanrostislavovich%2Fngx-translate-lint/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/romanrostislavovich%2Fngx-translate-lint/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/romanrostislavovich","download_url":"https://codeload.github.com/romanrostislavovich/ngx-translate-lint/tar.gz/refs/heads/develop","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/romanrostislavovich%2Fngx-translate-lint/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30086451,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-04T15:40:14.053Z","status":"ssl_error","status_checked_at":"2026-03-04T15:40:13.655Z","response_time":59,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":["angular","checker","cli","hacktoberfest","lint","linting","ngx-translate","translate","typescript","validator"],"created_at":"2024-10-28T22:01:30.093Z","updated_at":"2026-03-04T16:31:28.920Z","avatar_url":"https://github.com/romanrostislavovich.png","language":"TypeScript","funding_links":["https://github.com/sponsors/romanrostislavovich","https://tidelift.com/funding/github/npm/ngx-translate-lint"],"categories":["Development Utilities"],"sub_categories":["Internationalization"],"readme":"# ngx-translate-lint\n\n\u003e Simple tools for check ngx-translate keys in Angular applications in whole app which use regexp.\n\n[![semantic](https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg)](https://github.com/semantic-release/semantic-release)\n[![npm](https://img.shields.io/npm/v/ngx-translate-lint.svg)](https://www.npmjs.com/package/ngx-translate-lint)\n[![download npm](https://img.shields.io/npm/dm/ngx-translate-lint.svg)](https://www.npmjs.com/package/ngx-translate-lint)\n\n\u003e for `react-intl` use [`react-intl-lint`](https://www.npmjs.com/package/react-intl-lint)\n\u003e\n\u003e for `react-i18next` use [`react-i18next-lint`](https://www.npmjs.com/package/react-i18next-lint)\n\u003e\n\u003e for `desktop` use  [`ngx-translate-editor`](https://github.com/svoboda-rabstvo/ngx-translate-editor) \n\n## Table of Contents\n\n- [Background](#background)\n- [Installation](#installation)\n- [Usage](#usage)\n    - [CLI](#cli)\n    - [TypeScript](#typescript)\n- [Contribute](#contribute)\n- [Used By](#used-by)\n- [License](#license)\n\n## Background\n\nThere are a lot of translation [`ngx-translate`][ngx-translate] keys in the whole app.\nThis repository contains a proposal to check all translation keys in the whole app\nwhich should exist in all languages files.\n\n## Installation\n\n### NPM\n\n```bash\nnpm install ngx-translate-lint -g\n```\n\n### GitHub\n\nThe source code are available for download\nat [GitHub Releases][github-release-url] and\n[GitHub pages][github-pages-url] as well.\n\n## Usage\n\n### CLI\n\n```text\n\nUsage: ngx-translate-lint [options]\n\nSimple CLI tools for check `ngx-translate` keys in app\n\nOptions:\n  -p, --project [glob]                   \n          The path to project folder\n          Possible Values: \u003crelative path|absolute path\u003e\n          \n  -l, --languages [glob]                 \n          The path to languages folder\n          Possible Values: \u003crelative path|absolute path|URL\u003e\n          \n  --kv, --keysOnViews [enum]             \n          Described how to handle the error of missing keys on view\n          Possible Values: \u003cdisable|warning|error\u003e\n          \n  --zk, --zombieKeys [enum]              \n          Described how to handle the error of zombies keys. Zombie keys are keys that doesn't exist on any languages file but exist on project, or exist languages but doesn't exist on project\n          Possible Values: \u003cdisable|warning|error\u003e\n          \n  --ek, --emptyKeys [enum]               \n          Described how to handle empty value on translate keys. Empty keys are keys that doesn't have any value on languages files\n          Possible Values: \u003cdisable|warning|error\u003e\n          \n  -i, --ignore [glob]                    \n          Ignore projects and languages files\n          Possible Values: \u003crelative path|absolute path\u003e\n          \n  --maxWarning [glob]                    \n          Max count of warnings in all files. If this value more that count of warnings, then an error is return\n          Possible Values: \u003cnumber\u003e\n          \n  --mk, --misprintKeys [enum]            \n          Try to find matches with misprint keys on views and languages keys. Coefficient: 0.9. Can be longer process!!\n          Possible Values: \u003cdisable|warning|error\u003e\n          \n  --ds, --deepSearch [enum]              \n          Add each translate key to global regexp end try to find them on project. Can be longer process!!\n          Possible Values: \u003cdisable|enable\u003e\n          \n  --mc, --misprintCoefficient [number]   \n          Coefficient for misprint option can be from 0 to 1.0.\n          \n          \n  -c, --config [path]                    \n          Path to config via JSON or JS file\n          Possible Values: \u003crelative path|absolute path\u003e\n          \n  --fz, --fixZombiesKeys [boolean]       \n          Auto fix zombies keys on languages files\n          \n          \n  -v, --version                          Print current version of ngx-translate-lint\n  -h, --help                             display help for command\n\n\nExamples:\n\n    $ ngx-translate-lint -p ./src/app/**/*.{html,ts,resx} -l ./src/assets/i18n/*.json\n    $ ngx-translate-lint -p ./src/app/**/*.{html,ts,resx} -z disable -v error\n    $ ngx-translate-lint -p ./src/app/**/*.{html,ts,resx} -i ./src/assets/i18n/EN-us.json, ./src/app/app.*.{json}\n    $ ngx-translate-lint -p ./src/app/**/*.{html,ts,resx} -l https://8.8.8.8/locales/EN-eu.json\n```    \n\n\u003e NOTE: For `project` and `languages` options need to include file types like on the example.\n\nDefault JSON Config is:\n```json\n{\n    \"rules\": {\n        \"keysOnViews\": \"error\",\n        \"zombieKeys\": \"warning\",\n        \"misprintKeys\": \"disable\",\n        \"deepSearch\": \"disable\",\n        \"emptyKeys\": \"warning\",\n        \"maxWarning\": \"0\",\n        \"misprintCoefficient\": \"0.9\",\n        \"ignoredKeys\": [ \"IGNORED.KEY.(.*)\" ], // can be string or RegExp\n        \"ignoredMisprintKeys\": [],\n        \"customRegExpToFindKeys\": [ \"(?\u003c=marker\\\\(['\\\"])([A-Za-z0-9_\\\\-.]+)(?=['\\\"]\\\\))\"], // to find: marker('TRSNLATE.KEY');\n    },\n    \"fetch\": {\n        \"requestQuery\": \"\",\n        \"requestHeaders\": {},\n        \"responseQuery\": \"\"\n    },\n    \"fixZombiesKeys\": false,\n    \"project\": \"./src/app/**/*.{html,ts}\",\n    \"languages\": \"./src/assets/i18n/*.json\"\n}\n```\n\nJS Config should have `default` export via object like config. See example:\n\nExample JS config is:\n```javascript\n\nconst config = {\n    rules: {\n        keysOnViews: \"error\",\n        zombieKeys: \"warning\",\n        emptyKeys: \"warning\",\n        misprint: {\n            type: \"warning\",\n            coefficient: 0.9\n        },\n        ignoredKeys: [],\n        ignoredMisprintKeys: []\n    },\n    fetch: {\n        requestQuery: \"\",\n        requestHeaders: {},\n        responseQuery: \"\",\n        get: async () =\u003e {\n            const requestOne = fetch('https://8.8.8.8/locales/EN-eu.json');\n            const requestTwo = fetch('https://8.8.8.8/locales/EN-us.json');\n            const result = await Promise.all([requestOne, requestTwo]).then(async ([responseOne, responseTwo]) =\u003e {\n                return {\n                    ...(await responseOne.json()),\n                    ...(await  responseTwo.json())\n                }\n            });\n            // NOTE: result should contains only translation keys. Example \n            // {\n            //   \"translation.key\": \"value\"\n            // }\n            return result;\n        }\n    },\n    fixZombiesKeys: false,\n    project: \"./src/app/**/*.{html,ts}\",\n    languages: \"./src/assets/i18n/*.json\"\n}\n\nexport default config;\n```\n\n#### How to write Custom RegExp\n\nWe have `(?\u003c=marker\\\\(['\\\"])([A-Za-z0-9_\\\\-.]+)(?=['\\\"]\\\\))` RegExp witch contains of 3 parts:\n\n- Prefix - `(?\u003c=marker\\\\(['\\\"])`\n   - This construction tells that what we need matching before translate key\n   - start with `(?\u003c=` and end `)`.\n   - `marker\\\\(['\\\"]` - tells that we try to find word `market` witch have on the second character `'`or `\"`\n   - To summarize, we are trying to find keys before each word to be `market` and commas `'` or `\"`\n  \n- Matching for key: `([A-Za-z0-9_\\\\-.]+)`\n  - This construction tells that we find and save all words which contain alphabet, numbers, and `_` or `-`.\n  - We recommend using this part of RegExp to find and save translated keys\n  - But you can also use `(.*)` If it's enough for your project\n- Postfix - `(?=['\\\"]\\\\))` (the same as prefix, but need to be ended)\n  - This construction tells that what we need matching after translate key\n  - start with `(?=` and end `)`\n  - `['\\\"]\\\\)` - tells that we try to find word comas `'` or `\"` and ended with `)`\n  - To summarize, we are trying to find keys ended each word to be commas `'` or `\"` and `)`\n\nExample RegExp will find following keys\n  - `marker('TRSNLATE.KEY')`\n  - `marker(\"TRSNLATE.KEY-2\")`\n\n#### Exit Codes\n\nThe CLI process may exit with the following codes:\n\n- `0`: Linting succeeded without errors (warnings may have occurred)\n- `1`: Linting failed with one or more rule violations with severity error\n- `2`: An invalid command line argument or combination thereof was used\n\n### TypeScript\n\n```typescript\nimport {\n    ToggleRule,\n    NgxTranslateLint,\n    IRulesConfig,\n    ResultCliModel,\n    ErrorTypes,\n    LanguagesModel,\n    IFetch,\n    ngxTranslateRegEx,\n} from 'ngx-translate-lint';\n\nconst viewsPath: string = './src/app/**/*.{html,ts}';\nconst languagesPath: string = './src/assets/i18n/*.json';\nconst ignoredLanguagesPath: string = \"./src/assets/i18n/ru.json, ./src/assets/i18n/ru-RU.json\";\nconst ruleConfig: IRulesConfig = {\n    keysOnViews: ErrorTypes.error,\n    zombieKeys: ErrorTypes.warning,\n    misprintKeys: ErrorTypes.disable,\n    deepSearch: ToggleRule.disable,\n    emptyKeys: ErrorTypes.warning,\n    maxWarning: 0,\n    misprintCoefficient: 0.9,\n    fixZombiesKeys: false,\n    ignoredKeys: ['EXAMPLE.KEY', 'IGNORED.KEY.(.*)'], // can be string or RegExp\n    ignoredMisprintKeys: [],\n    customRegExpToFindKeys: [\"(?\u003c=marker\\\\(['\\\"])([A-Za-z0-9_\\\\-.]+)(?=['\\\"]\\\\))\"] // to find: marker('TRSNLATE.KEY');\n};\nconst fixZombiesKeys: boolean = false;\nconst fetchSettings: IFetch = {\n    requestQuery: \"\",\n    requestHeaders: {},\n    responseQuery: \"\",\n    get: () =\u003e {\n        // You fetch to get locales\n    }\n};\nconst ngxTranslateRegEx: ngxTranslateRegEx = ngxTranslateRegEx; // Here can be your array of regexp to find keys\nconst ngxTranslateLint = new NgxTranslateLint(viewsPath, languagesPath, ignoredLanguagesPath, ruleConfig, fixZombiesKeys, fetchSettings, ngxTranslateRegEx)\nconst resultLint: ResultCliModel = ngxTranslateLint.lint(); // Run Lint\nconst languages: LanguagesModel[] = ngxTranslateLint.getLanguages()  // Get Languages with all keys and views\n\n```\n\n## Contribute\n\nYou may contribute in several ways like requesting new features,\nadding tests, fixing bugs, improving documentation or examples.\nPlease check our [contributing guidelines][contributing].\n\n## Used By\n\nHere can be your extensions:\n\n- [ngx-translate-editor](https://github.com/svoboda-rabstvo/ngx-translate-editor) - Simple GUI for CRUD translate keys of ngx-translate, which included ngx-translate-lint\n- [121 Platform](https://github.com/global-121/121-platform) - 121 is an open source platform for Cash based Aid built with Digital Identity \u0026 Local/Global Financial service partners.\n\n## License\n\n\n[MIT][license-url]\n\n[ngx-translate]: https://github.com/ngx-translate/core\n[travis-shield]: https://img.shields.io/travis/svoboda-rabstvo/ngx-translate-lint/master.svg\n[travis-url]: https://travis-ci.com/svoboda-rabstvo/ngx-translate-lint/branches\n[semantic-shield]: https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg\n[semantic-url]: https://github.com/semantic-release/semantic-release\n[npm-shield]: https://img.shields.io/npm/v/svoboda-rabstvo/ngx-translate-lint.svg\n[npm-url]: https://www.npmjs.com/package/ngx-translate-lint\n[npm]: https://www.npmjs.com\n[node-js]: https://nodejs.org\n[github-shield]: https://img.shields.io/github/release/svoboda-rabstvo/ngx-translate-lint.svg?label=github\n[github-url]: https://github.com/svoboda-rabstvo/ngx-translate-lint\n[github-release-url]: https://github.com/svoboda-rabstvo/ngx-translate-lint/releases\n[github-pages-url]: https://svoboda-rabstvo.github.io/ngx-translate-lint/\n[schema-url]: http://json-schema.org/\n[web-url]: https://schema.linterhub.com\n[doc-url]: https://github.com/svoboda-rabstvo/ngx-translate-lint/blob/develop/doc\n[license-url]: https://github.com/svoboda-rabstvo/ngx-translate-lint/blob/develop/LICENSE.md\n[meta-url]: https://en.wikipedia.org/wiki/List_of_software_package_management_systems#Meta_package_managers\n[contributing]: https://github.com/svoboda-rabstvo/ngx-translate-lint/blob/develop/.github/CONTRIBUTING.md\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fromanrostislavovich%2Fngx-translate-lint","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fromanrostislavovich%2Fngx-translate-lint","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fromanrostislavovich%2Fngx-translate-lint/lists"}