{"id":21277723,"url":"https://github.com/reececomo/transl8r","last_synced_at":"2025-03-15T13:25:19.791Z","repository":{"id":52952818,"uuid":"340958913","full_name":"reececomo/transl8r","owner":"reececomo","description":"A simple utility for managing JSON language files in projects","archived":false,"fork":false,"pushed_at":"2021-04-13T05:56:10.000Z","size":145,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-01-22T03:42:27.604Z","etag":null,"topics":["i18n","l10n","language","multi-lingual","translation"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/reececomo.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2021-02-21T17:20:14.000Z","updated_at":"2021-04-13T05:50:28.000Z","dependencies_parsed_at":"2022-08-28T09:03:39.872Z","dependency_job_id":null,"html_url":"https://github.com/reececomo/transl8r","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/reececomo%2Ftransl8r","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/reececomo%2Ftransl8r/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/reececomo%2Ftransl8r/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/reececomo%2Ftransl8r/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/reececomo","download_url":"https://codeload.github.com/reececomo/transl8r/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243734340,"owners_count":20339273,"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":["i18n","l10n","language","multi-lingual","translation"],"created_at":"2024-11-21T10:07:22.934Z","updated_at":"2025-03-15T13:25:19.752Z","avatar_url":"https://github.com/reececomo.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Transl8r ✍️\n\n**역자** - **译者** - **μεταφράστης** - **ਅਨੁਵਾਦਕ** - **tercüman** - **thông dịch viên** - **مترجم**\n\nA simple utility for managing JSON language files in projects.\n\n- [x] Add/remove keys to multiple languages at once.\n- [x] Automatically provide fallback translations (provided by Google Translate).\n- [x] Perform basic sanity checking.\n- [x] Sort translation files.\n- [x] Validate translation files.\n- [x] Export TODO language translations as CSV.\n- [x] Import CSV language files.\n\n## Install\n\n- Install the package.\n- Create a `.transl8r.yml` configuration in your project root.\n- (Optional) Set up your [Google Translate Credentials](https://cloud.google.com/docs/authentication/getting-started) (required for `--add`, `--alt` and `--backfill` commands)\n\n### Example\n\n#### `.transl8r.yml`\n\n```yml\ngroup: example\nlanguages:\n  base: en\n  other: ['fr', 'de']\nnamespaces:\n  target: base.generated\n  other: ['legal', 'base']\npath: '/resources/lang/{{lang}}/{{namespace}}.json'\nvalidation:\n  mismatchedPlaceholders:\n    - error.validation.required\n```\n\n## Basic Usage\n\nGet a full list of commands like this:\n\n```bash\nyarn transl8r --help\n```\n\n## Usage\n\n### Housekeeping\n\n#### `--lint` Lint translation files\n\nLets you know if there's any issues that may affect the translation files.\n\n```bash\nFailed to validate, there were 2 errors:\nfr: \"error.validation.required\" has mismatched markup tags:\n - \u003c0\u003e,\u003c/0\u003e vs \u003cnone\u003e\nfr: \"error.validation.required\" has mismatched placeholders:\n - {{label}} vs \u003cnone\u003e\n```\n\n\u003e You may use the YAML file to silence warnings for mismatched placeholders.\n\n#### `--clean` Clean unreachable translations\n\nRemove dead keys from generated files where they exist in the professional translation file.\n\n```bash\nyarn transl8r --clean\n  fr:     Up to date ✓\n  de:     Purged 14 unreachable key(s).\n  ✨  Done in 0.53s.\n```\n\n#### `--sort` Sort translation files\n\nSort all the language files by key.\n\n### Managing translations\n\n#### `--add` (or `-a`) Add single key\n\nAdds a new generated key to all language files, including the base language.\n\n```bash\nyarn transl8r -a button.dismiss.label\n  \u003e\u003e value:  Dismiss\n\n  el:     Απολύω\n          → Fire\n  it:     Respingere\n          → Reject\n  ...\n✨  Done in 3.87s.\n```\n\n#### `--alt` Lost in translation?\n\nUse alternative copy for the translations, without affecting the base (English) translation.\n\n\u003e For example: \"Dismiss\" has many meanings in English, such as \"to treat as unworthy of serious consideration\".\n\u003e A phrase like \"Close prompt\" may translate better.\n\n```\nyarn transl8r --alt button.dismissPrompt.label  -l ar it zh-tw\n\u003e\u003e translateAs:  Close prompt\n\nar:     موجه إغلاق\n        → Close prompt\n\nit:     Chiudi prompt\n        → Close prompt\n\nzh-tw:  關閉提示\n        → Turn off the prompt\n\n✨  Done in 1.46s.\n```\n\n#### `--remove` Remove a single key\n\nWhen you've added a key you no longer want:\n\n```\nyarn transl8r --remove button.legacy.close\n```\n\n#### `--backfill` Backfill missing translations\n\n**Note:** This command currently does not reverse translations for sanity checking.\n\n```bash\nyarn transl8r --backfill\n\n# ...or specific languages only\nyarn transl8r --backfill -l fr de\n```\n\n\n### CSV import/export\n\n#### `--exportTodo` Export strings that need translating\n\nExports a .ZIP archive containing CSV files ready to translate.\n\n```\nmy-app-todo-2022-07-23.zip/\n  my-app.es.csv\n  my-app.fr.csv\n  my-app.zh-cn.csv\n```\n\n##### Format example\n\n| contextKey    | en            | fr    |\n| ------------- | ------------- | ----- |\n| btn.continue  | Continue      |       |\n| btn.cancel    | Cancel        |       |\n| btn.dismiss   | Dismiss       |       |\n\n#### `--importCsv` Import strings that need translating\n\nExports a .ZIP archive containing CSV files ready to translate.\n\n#### Accepts these formats:\n\n##### Translated base format\n\n| contextKey    | en            | fr        |\n| ------------- | ------------- | --------- |\n| btn.continue  | Continue      | Continuez |\n| btn.cancel    | Cancel        | Annuler   |\n| btn.dismiss   | Dismiss       | Rejeter   |\n\n##### Translations only format\n\n| contextKey    | fr        |\n| ------------- | --------- |\n| btn.continue  | Continuez |\n| btn.cancel    | Annuler   |\n| btn.dismiss   | Rejeter   |\n\n### Options\n\n- `-l` - Supply list of language codes to fetch (space seperated: `-l fr de es`)\n- `-p` - Path to match the language files on (use `{{lang}}` and `{{namespace}}` placeholders)\n- `-b` - Base language to translate from (default: `en`)\n- `-n` - The destination namespace (default: `base.generated`)\n\nSay for example, you add a new translation for Catalyst into French, and you want to backfill it to English and Chinese (Traditional).\n\n```bash\nyarn transl8r --backfill  -b fr  -l en zh-TW\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Freececomo%2Ftransl8r","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Freececomo%2Ftransl8r","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Freececomo%2Ftransl8r/lists"}