{"id":50982776,"url":"https://github.com/netgen/i18n-csv-converter","last_synced_at":"2026-06-19T16:03:48.175Z","repository":{"id":334006766,"uuid":"1139627738","full_name":"netgen/i18n-csv-converter","owner":"netgen","description":null,"archived":false,"fork":false,"pushed_at":"2026-01-22T08:16:03.000Z","size":14,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"master","last_synced_at":"2026-01-22T22:57:27.723Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"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/netgen.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,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2026-01-22T07:50:55.000Z","updated_at":"2026-01-22T08:16:07.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/netgen/i18n-csv-converter","commit_stats":null,"previous_names":["netgen/i18n-converter"],"tags_count":null,"template":false,"template_full_name":null,"purl":"pkg:github/netgen/i18n-csv-converter","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/netgen%2Fi18n-csv-converter","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/netgen%2Fi18n-csv-converter/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/netgen%2Fi18n-csv-converter/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/netgen%2Fi18n-csv-converter/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/netgen","download_url":"https://codeload.github.com/netgen/i18n-csv-converter/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/netgen%2Fi18n-csv-converter/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34538480,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-19T02:00:06.005Z","response_time":61,"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":[],"created_at":"2026-06-19T16:03:47.056Z","updated_at":"2026-06-19T16:03:48.158Z","avatar_url":"https://github.com/netgen.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# i18n-csv-converter\n\nA CLI tool for converting between CSV and JSON translation formats for i18n applications.\n\n## Installation\n\n### Using npx (recommended)\n\nNo installation needed! Just use `npx`:\n\n```bash\nnpx i18n-csv-converter \u003ccommand\u003e\n```\n\n### Local installation\n\n```bash\nnpm install -g i18n-csv-converter\n```\n\nOr install locally in your project:\n\n```bash\nnpm install i18n-csv-converter\n```\n\n## Assumptions\n\nThe tool makes the following assumptions:\n\n- **JSON filenames**: When using `json-to-csv` with a directory or file list, language codes are inferred from filenames. Files should be named with the language code as the filename (e.g., `en.json`, `hr.json`, `de.json`). The language code is extracted by removing the `.json` extension.\n- **CSV header row**: When using `csv-to-json` without the `--languages` option, the first row is assumed to be a header containing the key column and language codes (e.g., `key,en,hr,de`).\n\n## Usage\n\n### CSV to JSON\n\nConvert a CSV file to multiple JSON files (one per language):\n\n```bash\n# Auto-detect languages from header row\nnpx i18n-csv-converter csv-to-json input.csv --output-dir ./output\n\n# Or specify languages explicitly (first row will be skipped)\nnpx i18n-csv-converter csv-to-json input.csv --languages hr,sl,rs --output-dir ./output\n```\n\n**Options:**\n- `-l, --languages \u003clanguages\u003e`: Comma-separated list of language codes (optional - if not provided, languages are auto-detected from the header row)\n- `-o, --output-dir \u003cdir\u003e`: Output directory for JSON files (default: `./output`)\n- `-f, --fallback \u003clang\u003e`: Fallback language code (defaults to first language)\n- `--key-column \u003cindex\u003e`: Column index for keys (0-based, default: `0`)\n\n**Behavior:**\n- **Without `--languages`**: The first row is treated as a header. Languages are auto-detected from the header columns (after the key column), and the header row is skipped when processing data.\n- **With `--languages`**: The first row is skipped (treated as header), and the provided languages are used.\n\n**Examples:**\n```bash\n# Auto-detect from header (recommended)\nnpx i18n-csv-converter csv-to-json ./translations.csv -o ./locales\n\n# Explicit languages (skip header row)\nnpx i18n-csv-converter csv-to-json input.csv -l en,fr,de -o ./locales\n\n# With custom key column and fallback\nnpx i18n-csv-converter csv-to-json input.csv -l hr,sl,rs --key-column 0 -f hr\n```\n\n**CSV Format:**\nThe CSV should have the key in the first column (or specified column), followed by translation columns for each language. If using auto-detection, include a header row:\n\n```csv\nkey,hr,sl,rs\ncommon.hello,Hello,Hej,Здравствуйте\ncommon.goodbye,Goodbye,Hej då,До свидания\nnested.deep.key,Value,Value,Value\n```\n\n### JSON to CSV\n\nConvert JSON file(s) or directory to CSV format with multiple language columns:\n\n```bash\n# Convert directory (auto-detects all JSON files and languages from filenames)\nnpx i18n-csv-converter json-to-csv ./locales --output output.csv\n\n# Convert multiple files explicitly\nnpx i18n-csv-converter json-to-csv en.json hr.json de.json --output output.csv\n```\n\n**Options:**\n- `-o, --output \u003cfile\u003e`: Output CSV file path (default: `./output.csv`)\n- `-s, --separator \u003cchar\u003e`: Key separator for nested keys (default: `.`)\n\n**Behavior:**\n- **Directory input**: Scans the directory for all `*.json` files and auto-detects language codes from filenames (e.g., `en.json` → `en`, `hr.json` → `hr`)\n- **File list input**: Processes the specified files and auto-detects languages from each filename\n- Languages are sorted alphabetically in the output CSV\n\n**Note:** The tool assumes JSON files are named with language codes as the filename (without extension). For example:\n- ✅ `en.json` → language code: `en`\n- ✅ `hr.json` → language code: `hr`\n- ✅ `en-US.json` → language code: `en-US`\n- ❌ `translations_en.json` → language code: `translations_en` (not recommended)\n\n**Examples:**\n```bash\n# Convert all JSON files in a directory\nnpx i18n-csv-converter json-to-csv ./locales/common -o ./translations/common.csv\n\n# Convert specific files\nnpx i18n-csv-converter json-to-csv en.json hr.json de.json -o output.csv\n\n# With custom separator\nnpx i18n-csv-converter json-to-csv input.json -o output.csv -s _\n```\n\n**Input JSON Format:**\nNested JSON objects are flattened using dot notation. Each language file should have the same structure:\n\n```json\n{\n  \"common\": {\n    \"hello\": \"Hello\",\n    \"goodbye\": \"Goodbye\"\n  },\n  \"nested\": {\n    \"deep\": {\n      \"key\": \"Value\"\n    }\n  }\n}\n```\n\n**Output CSV Format:**\nThe CSV includes a header row with `key` and language columns, followed by data rows:\n\n```csv\nkey,en,hr,de\ncommon.hello,Hello,Hej,Hallo\ncommon.goodbye,Goodbye,Hej då,Auf Wiedersehen\nnested.deep.key,Value,Vrijednost,Wert\n```\n\n## Features\n\n- ✅ Support for arbitrary number of languages\n- ✅ Auto-detection of languages from CSV headers or JSON filenames\n- ✅ Multiple input modes: single file, multiple files, or directory scanning\n- ✅ Configurable input/output paths\n- ✅ Fallback language support\n- ✅ Bidirectional conversion (CSV ↔ JSON)\n- ✅ Nested JSON structure support\n- ✅ Works with `npx` (no installation required)\n- ✅ Cross-platform (Windows, macOS, Linux)\n\n## Development\n\n```bash\n# Install dependencies\nnpm install\n\n# Build TypeScript\nnpm run build\n\n# Run locally (after build)\nnode dist/cli.js csv-to-json input.csv\nnode dist/cli.js json-to-csv ./locales -o output.csv\n```\n\n## License\n\nThis project is licensed under the [MIT License](LICENSE).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnetgen%2Fi18n-csv-converter","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnetgen%2Fi18n-csv-converter","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnetgen%2Fi18n-csv-converter/lists"}