{"id":29659688,"url":"https://github.com/simplelocalize/i18n-key-scanner","last_synced_at":"2025-10-24T22:40:42.188Z","repository":{"id":304812415,"uuid":"1019750483","full_name":"simplelocalize/i18n-key-scanner","owner":"simplelocalize","description":"Find and extract keys and translations from your source code","archived":false,"fork":false,"pushed_at":"2025-07-15T10:50:11.000Z","size":64,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-10-05T21:49:51.057Z","etag":null,"topics":["cli","i18n"],"latest_commit_sha":null,"homepage":"https://simplelocalize.io","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/simplelocalize.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"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}},"created_at":"2025-07-14T20:12:46.000Z","updated_at":"2025-07-15T10:54:28.000Z","dependencies_parsed_at":"2025-07-16T00:08:24.599Z","dependency_job_id":"3922964e-3ef5-4d4f-b161-9083cbdd545f","html_url":"https://github.com/simplelocalize/i18n-key-scanner","commit_stats":null,"previous_names":["simplelocalize/i18n-key-scanner"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/simplelocalize/i18n-key-scanner","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/simplelocalize%2Fi18n-key-scanner","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/simplelocalize%2Fi18n-key-scanner/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/simplelocalize%2Fi18n-key-scanner/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/simplelocalize%2Fi18n-key-scanner/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/simplelocalize","download_url":"https://codeload.github.com/simplelocalize/i18n-key-scanner/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/simplelocalize%2Fi18n-key-scanner/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":280878345,"owners_count":26406641,"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","status":"online","status_checked_at":"2025-10-24T02:00:06.418Z","response_time":73,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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":["cli","i18n"],"created_at":"2025-07-22T09:36:26.306Z","updated_at":"2025-10-24T22:40:42.158Z","avatar_url":"https://github.com/simplelocalize.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# i18n-key-extract\n\nA modular CLI tool to extract i18n keys and default translations from your codebase. Supports multiple strategies (i18next, react-intl, data-i18n-key, EJS, Apple, Android, and more) with per-strategy configuration.\n\n## Installation\n\n```\nnpm install -g i18n-key-extract\n```\n\nOr use locally:\n\n```\nnpm install --save-dev i18n-key-extract\n```\n\n## Usage\n\n### Basic CLI Usage\n\n```\ni18n-key-extract --strategy \u003cstrategy\u003e --src \u003cglob\u003e\n```\n\n- `--strategy` (required): Extraction strategy to use. Supported: `i18next`, `react-intl`, `data-i18n-key`, `ejs`, `apple`, `android`.\n- `--src` (required): Glob pattern for files to scan (e.g. `src/**/*.js`).\n- `--config`: Path to a JSON config file for the strategy (optional).\n- `--out`: Output file for extracted keys (optional).\n\n### Example: Extract i18next keys from JS/TS files\n\n```\ni18n-key-extract --strategy i18next --src \"src/**/*.{js,ts,jsx,tsx}\"\n```\n\n### Example: Extract react-intl keys from React files\n\n```\ni18n-key-extract --strategy react-intl --src \"src/**/*.{js,jsx,ts,tsx}\"\n```\n\n### Example: Extract data-i18n-key from HTML\n\n```\ni18n-key-extract --strategy data-i18n-key --src \"public/**/*.html\"\n```\n\n### Example: Use a custom config file\n\n```\ni18n-key-extract --strategy i18next --src \"src/**/*.{js,ts}\" --config i18next.config.json\n```\n\n## Per-Strategy Configuration\n\nEach strategy supports its own config options. You can provide a config file (JSON) via `--config` or rely on built-in defaults.\n\n#### Example i18next config (`i18next.config.json`):\n\n```json\n{\n  \"includeExtensions\": [\".js\", \".ts\", \".jsx\", \".tsx\"],\n  \"excludeDirs\": [\"node_modules\", \"dist\"]\n}\n```\n\n#### Example data-i18n-key config (`data-i18n-key.config.json`):\n\n```json\n{\n  \"selector\": \"[data-i18n-key]\",\n  \"keyAttr\": \"data-i18n-key\",\n  \"textAttr\": null\n}\n```\n\n## Output\n\nBy default, results are printed to stdout as JSON. Use `--out` to write to a file:\n\n```\ni18n-key-extract --strategy i18next --src \"src/**/*.js\" --out keys.json\n```\n\n## Supported Strategies\n\n- **i18next**: Extracts from `t('key', 'Default')`, `t('key', { defaultValue })`, `i18nKey` attributes.\n- **react-intl**: Extracts from `\u003cFormattedMessage\u003e`, `\u003cFormattedHTMLMessage\u003e`, `intl.formatMessage`, `defineMessages`.\n- **data-i18n-key**: Extracts from HTML elements with `data-i18n-key`.\n- **ejs**: Extracts from EJS templates using `t('key')`.\n- **apple**: Extracts from Apple `.strings` files.\n- **android**: Extracts from Android `strings.xml` files.\n\n## Example Output\n\n```json\n[\n  { \"key\": \"hello\", \"translation\": \"Hello world!\", \"filePath\": \"src/app.js\" },\n  { \"key\": \"bye\", \"translation\": \"Goodbye!\", \"filePath\": \"src/app.js\" }\n]\n```\n\n## Contributing\n\nPRs and issues welcome!\n\n## License\n\nMIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsimplelocalize%2Fi18n-key-scanner","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsimplelocalize%2Fi18n-key-scanner","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsimplelocalize%2Fi18n-key-scanner/lists"}