{"id":19163340,"url":"https://github.com/maemreyo/i18n-types-gen","last_synced_at":"2026-05-15T22:04:52.891Z","repository":{"id":256252445,"uuid":"850164491","full_name":"maemreyo/i18n-types-gen","owner":"maemreyo","description":"A TypeScript utility for generating strongly-typed i18n keys from JSON language files. Supports versioning, key conflict detection, and custom output directories.","archived":false,"fork":false,"pushed_at":"2024-11-08T02:26:59.000Z","size":106,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-02-22T22:42:50.180Z","etag":null,"topics":["generator","i18n","i18next","json","localization","translation","type","typescript","utilities","versioning"],"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/maemreyo.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","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}},"created_at":"2024-08-31T03:17:53.000Z","updated_at":"2024-11-08T02:27:03.000Z","dependencies_parsed_at":"2025-01-03T21:43:47.578Z","dependency_job_id":"b951680b-2ec3-4d01-8447-6147e0f10e1d","html_url":"https://github.com/maemreyo/i18n-types-gen","commit_stats":null,"previous_names":["maemreyo/i18n-types-gen"],"tags_count":28,"template":false,"template_full_name":"maemreyo/nodets-template","purl":"pkg:github/maemreyo/i18n-types-gen","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/maemreyo%2Fi18n-types-gen","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/maemreyo%2Fi18n-types-gen/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/maemreyo%2Fi18n-types-gen/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/maemreyo%2Fi18n-types-gen/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/maemreyo","download_url":"https://codeload.github.com/maemreyo/i18n-types-gen/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/maemreyo%2Fi18n-types-gen/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":278846971,"owners_count":26056217,"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-07T02:00:06.786Z","response_time":59,"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":["generator","i18n","i18next","json","localization","translation","type","typescript","utilities","versioning"],"created_at":"2024-11-09T09:14:58.420Z","updated_at":"2025-10-07T21:06:47.491Z","avatar_url":"https://github.com/maemreyo.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# i18n TypeScript Generator\n\nThis package is a utility for generating TypeScript interfaces from i18n JSON files, making it easier to manage and use localization keys in TypeScript projects. It supports complex, nested JSON structures, automatically generates types, and ensures that all localization keys are consistent across different languages.\n\n## Features\n\n- **Deep/Nested JSON Support**: Automatically converts nested JSON keys into flat TypeScript interface keys while maintaining the original JSON structure.\n- **Dry Run Mode**: Preview the output before generating files to ensure everything is correct without making any changes to the file system.\n- **Key Conflict Warnings**: Alerts you to any duplicate or missing keys across different language files, helping you maintain consistency.\n- **Versioning**: Automatically generates versioned output directories to keep track of different sets of generated TypeScript interfaces.\n- **Sorted Keys**: Ensures that all keys in the generated TypeScript interfaces and JSON files are sorted alphabetically, making the files easy to navigate and maintain.\n- **Automatic Key Addition**: Automatically adds missing keys across different language files to ensure consistency.\n- **Customizable Paths**: Allows you to set custom paths for your locales and output directories.\n\n## Installation\n\n### Via npm\n\n```bash\nnpm install --save-dev i18n-types-generator\n```\n\n### Via yarn\n\n```bash\nyarn add --dev i18n-types-generator\n```\n\n## Usage\n\n### Programmatic Usage\n\nYou can use the generator programmatically in your Node.js scripts:\n\n```javascript\nconst { generateTypes } = require('i18n-types-generator');\n\ngenerateTypes({\n  localePath: './src/locales',\n  typesPath: './src/types/i18n',\n  autoAddMissingKeys: true,\n  dryRun: false,\n});\n```\n\n### Example Structure\n\nAssuming you have the following JSON files:\n\n```plaintext\nsrc/\n├── locales/\n│   ├── en/\n│   │   ├── common.json\n│   │   └── auth.json\n│   └── vi/\n│       ├── common.json\n│       └── auth.json\n```\n\nYour TypeScript output might look like this:\n\n```plaintext\nsrc/\n├── types/\n│   └── i18n_v1/\n│       ├── _common.ts\n│       ├── _auth.ts\n│       └── index.ts\n```\n\n### Configuration\n\nYou can customize the generator's behavior via the following options:\n\n- **`localePath`**: Path to the directory containing your i18n JSON files (default: `./src/locales`).\n- **`typesPath`**: Path to the output directory for TypeScript files (default: `./src/types/i18n`).\n- **`autoAddMissingKeys`**: Automatically add missing keys across all languages (default: `true`).\n- **`dryRun`**: Run the generator in dry run mode to preview the output without making any changes (default: `false`).\n\n### Advanced Features\n\n#### Versioning\n\nThe tool automatically generates versioned directories for each run to ensure you can track changes over time.\n\n#### Key Conflict Warnings\n\nIf the same key exists in multiple JSON files with different values, the generator will warn you about the conflict so you can resolve it manually.\n\n### Limitations\n\n- Currently, this tool assumes all JSON files are properly formatted. Any malformed JSON will be skipped with a warning.\n- The tool is designed to work with JSON files. Other formats are not supported at this time.\n\n## Contributing\n\nContributions are welcome! Please submit a pull request or open an issue on GitHub.\n\n### To get started:\n\n1. Clone the repository:\n   ```bash\n   git clone https://github.com/yourusername/i18n-types-generator.git\n   ```\n2. Install dependencies:\n   ```bash\n   npm install\n   ```\n3. Make your changes and create a pull request.\n\n## License\n\nThis project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.\n\n## Acknowledgments\n\n- Inspired by the need to maintain consistent localization across large TypeScript projects.\n- Thanks to the community for feedback and contributions.\n\n---\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmaemreyo%2Fi18n-types-gen","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmaemreyo%2Fi18n-types-gen","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmaemreyo%2Fi18n-types-gen/lists"}