{"id":19269845,"url":"https://github.com/lyqht/deepl-translate-github-action","last_synced_at":"2025-10-05T01:08:57.865Z","repository":{"id":167900303,"uuid":"642820025","full_name":"lyqht/deepl-translate-github-action","owner":"lyqht","description":"Github Action to translate text in dev projects","archived":false,"fork":false,"pushed_at":"2025-03-04T05:53:53.000Z","size":331,"stargazers_count":39,"open_issues_count":4,"forks_count":4,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-04-01T16:05:31.944Z","etag":null,"topics":["deepl","github-actions","hackathon","i18n"],"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/lyqht.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}},"created_at":"2023-05-19T12:22:11.000Z","updated_at":"2025-03-15T12:48:08.000Z","dependencies_parsed_at":null,"dependency_job_id":"75e0f688-f836-4907-abe3-f95a4e49e715","html_url":"https://github.com/lyqht/deepl-translate-github-action","commit_stats":null,"previous_names":["lyqht/deepl-translate-github-action"],"tags_count":13,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lyqht%2Fdeepl-translate-github-action","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lyqht%2Fdeepl-translate-github-action/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lyqht%2Fdeepl-translate-github-action/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lyqht%2Fdeepl-translate-github-action/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/lyqht","download_url":"https://codeload.github.com/lyqht/deepl-translate-github-action/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250128450,"owners_count":21379514,"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":["deepl","github-actions","hackathon","i18n"],"created_at":"2024-11-09T20:22:12.692Z","updated_at":"2025-10-05T01:08:52.827Z","avatar_url":"https://github.com/lyqht.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# DeepL Translate Github Action\n\n\u003e 🏆 v1.0.0 of this github action was awarded the [Grand Prize of Maintainer must-haves category in the GitHub + DEV 2023 Hackathon](https://dev.to/devteam/github-dev-2023-hackathon-winners-announced-236o)\n\n## Intro\n\nThis action uses the [DeepL Translate API](https://github.com/DeepLcom/deepl-node) to translate files in your repository to any target languages supported by DeepL. \nSince DeepL API does not officially support markdown tag handling yet, this github action helps to mitigate some issues that DeepL may have when it comes to `.md` documents.\n\n✨ In v1.0.0, **common text files** such as `.md | .html | .xml | .txt` are supported.\n\n✨ From v2.0.0 onwards, flat **locale JSON** files are also supported.\n\n✨ From v2.1.0 onwards, nested **locale JSON** files are also supported.\n\n## Inputs\n\n| Name                       | Description                                                                                                                                                                                       | Required |\n| -------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | :------: |\n| `deepl_api_key`            | API Key for DeepL API                                                                                                                                                                             |   yes    |\n| `target_languages`         | Target languages to translate to. Refer to [DeepL docs for language codes](https://www.deepl.com/docs-api/translate-text). You can also input `all` for all target languages that DeepL supports. |   yes    |\n| `input_file_path`          | Path of the file you want to translate. Accepts `.html, .xml, .md, .txt, .json`                                                                                                                   |   yes    |\n| `output_file_name_pattern` | Output file name pattern. e.g: `public/locales/{language}/common.json` where language is replaced by the target language code                                                                  |    yes    |\n| `no_translate_start_tag`   | Start tag to ignore when translating in the case of HTML-like files such as `.html, .xml, .md, .txt`                                                                                                    |    no    |\n| `no_translate_end_tag`     | End tag to ignore when translating in the case of HTML-like files such as `.html, .xml, .md, .txt`.                                                                                                     |    no    |\n\n## Example usage\n\n### For standard text files such as `.md`, `.html`, `.xml`, `.txt`\n\n```yaml\nname: Translate documents from docs/simple folder\non:\n  workflow_dispatch:\n  pull_request:\n    types: [opened, synchronize]\n\njobs:\n  build:\n    runs-on: ubuntu-latest\n    steps:\n      - name: DeepL Translate Github Action\n        uses: lyqht/deepl-translate-github-action@v2.0.0\n        with:\n          target_languages: zh,ja\n          input_file_path: docs/simple/original.md\n          output_file_name_pattern: docs/simple/{language}.md\n          deepl_api_key: ${{ secrets.DEEPL_API_KEY }}\n```\n\nWith this workflow, you will get `docs/simple/zh.md` and `docs/simple/ja.md`\n\n### For locale json\n\n```yaml\nname: Translate locales json\non:\n  workflow_dispatch:\n  pull_request:\n    types: [opened, synchronize]\n\njobs:\n  build:\n    runs-on: ubuntu-latest\n    steps:\n      - name: DeepL Translate Github Action\n        uses: lyqht/deepl-translate-github-action@v2.1.0\n        with:\n          target_languages: fr,ja\n          input_file_path: locales/en.json\n          output_file_name_pattern: locales/{language}.json\n          deepl_api_key: ${{ secrets.DEEPL_API_KEY }}\n```\n\nWith this workflow, you will get `locales/fr.json`, `locales/ja.json`.\n\n## Demo\n\n- For a simple demo of translating HTML-like text files, refer to the [deepl-demo](https://github.com/lyqht/deepl-demo) repository.\n- For a more advanced demo of translating both the `README.md` and `locale/x.json`, refer to [nuxt3-app-vue-i18n](https://github.com/lyqht/nuxt3-app-vue-i18n) repository, with a deployed app.\n\nWhen the github action runs, it will produce commits like the following based on your input paths.\n\n![CleanShot 2023-06-23 at 10 44 40](https://github.com/lyqht/deepl-translate-github-action/assets/35736525/46de3b8a-11e1-400d-9c0d-7732ecaac958)\n\n\n### For nested locale JSON\n\n```yaml\nname: Translate locale commons json\non:\n  workflow_dispatch:\n  pull_request:\n    types: [opened, synchronize]\n\njobs:\n  build:\n    runs-on: ubuntu-latest\n    steps:\n      - name: DeepL Translate Github Action\n        uses: lyqht/deepl-translate-github-action@v2.1.0\n        with:\n          target_languages: fr,ja\n          input_file_path: public/locales/en/common.json\n          output_file_name_pattern: public/locales/{language}/common.json\n          deepl_api_key: ${{ secrets.DEEPL_API_KEY }}\n```\n\nWith this workflow, you will get `public/locales/fr/common.json`, `public/locales/ja/common.json`.\n\nFor a demo, refer to [refine-i18n-react](https://github.com/lyqht/refine-i18n-react) repository, with a deployed app.\n\n## FAQ\n\n\u003cdetails\u003e\u003csummary\u003eHow to get DeepL API Token\u003c/summary\u003e\n\nFirst, you need to [sign up for the free DeepL API plan](https://www.deepl.com/docs-api). Then you can go to https://www.deepl.com/account/summary and retrieve your token there.\n\n![Screenshot of where the auth key is located on the website](DeepL_API_Auth_Key_Example.png)\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\u003csummary\u003eIf you don't have an existing GitHub Action workflow for your repository\u003c/summary\u003e\n\n1. Create a folder `.github/workflows` if you don't have it already\n2. Inside that folder, create a YAML file say `translate.yml`\n3. In the `translate.yml` file, you can copy the example below and modify it to your usage.\n\u003c/details\u003e\n\n\u003cdetails\u003e\u003csummary\u003eWhy am I getting an error of \"Permission to git denied to github-actions[bot]\"\u003c/summary\u003e\n\nYou have to set the workflow permissions under Repository Settings \u003e Actions \u003e Workflow permissions to be **\"Read and write permissions\"**.\n\n![](workflow_permissions_screenshot.png)\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\u003csummary\u003eThe script is cool but I don't want to use a GitHub action. Can I run it locally?\u003c/summary\u003e\n\nWell, you're in luck! Refer to `local.ts` and modify your env variables accordingly.\n\n\u003c/details\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flyqht%2Fdeepl-translate-github-action","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flyqht%2Fdeepl-translate-github-action","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flyqht%2Fdeepl-translate-github-action/lists"}