{"id":16697008,"url":"https://github.com/seratch/notion-translator","last_synced_at":"2025-03-17T00:33:41.764Z","repository":{"id":57701847,"uuid":"498584466","full_name":"seratch/notion-translator","owner":"seratch","description":"CLI tool to translate Notion pages into a different language","archived":false,"fork":false,"pushed_at":"2023-10-06T13:37:56.000Z","size":35,"stargazers_count":64,"open_issues_count":4,"forks_count":19,"subscribers_count":4,"default_branch":"main","last_synced_at":"2024-04-25T19:02:10.634Z","etag":null,"topics":["cli","deepl","machine-translation","nodejs","notion"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","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/seratch.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":"2022-06-01T04:01:32.000Z","updated_at":"2024-04-19T05:15:42.000Z","dependencies_parsed_at":"2024-10-12T17:45:48.423Z","dependency_job_id":null,"html_url":"https://github.com/seratch/notion-translator","commit_stats":{"total_commits":12,"total_committers":1,"mean_commits":12.0,"dds":0.0,"last_synced_commit":"82582c72ceec9e7f06c81925bc41c60e5cc525df"},"previous_names":[],"tags_count":7,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/seratch%2Fnotion-translator","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/seratch%2Fnotion-translator/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/seratch%2Fnotion-translator/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/seratch%2Fnotion-translator/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/seratch","download_url":"https://codeload.github.com/seratch/notion-translator/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243835942,"owners_count":20355611,"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":["cli","deepl","machine-translation","nodejs","notion"],"created_at":"2024-10-12T17:45:46.206Z","updated_at":"2025-03-17T00:33:41.473Z","avatar_url":"https://github.com/seratch.png","language":"JavaScript","funding_links":[],"categories":["JavaScript"],"sub_categories":[],"readme":"# Notion Translator\n\n[![npm version](https://badge.fury.io/js/notion-translator.svg)](https://badge.fury.io/js/notion-translator)\n\nNotion Translator is a CLI tool that enables [Notion](https://www.notion.so/) users to translate Notion pages into a different language by leveraging [the DeepL's text translation API](https://www.deepl.com/api).\n\nYou can install this tool just by running:\n\n```bash\nnpm install -g notion-translator\n```\n\n## How It Works\n\nLet's say you'd like to translate a Notion page template written in English into a differen language such as Japanese, Spainish, and French. All you need to do with **notion-translator** are:\n\n* Create a Notion internal integration and save its token as `NOTION_API_TOKEN` env variable\n* Create a DeepL API account and save its token as `DEEPL_API_TOKEN` env variable\n* Share the target Notion page with your Notion integration\n* Run the following command to generate a translated page automatically\n\n```bash\nnotion-translator \\\n  --from en \\\n  --to ja \\\n  --url https://www.notion.so/acme/Blog-Post-ABC123\n```\n\n## Live Demo\n\nOnce you create your integration for translation and set the Notion / DeepL credentials in env variables, you can run the command to translate with the Notion page URL:\n\n\u003cimg src=\"https://user-images.githubusercontent.com/19658/171323954-6d7e1475-4e1b-4b4e-a4b3-2adb1a81aea1.gif\" width=500 /\u003e\n\nWhen the translated page is ready, the CLI opens the page in the default web browser for you. The CLI generates the page as a child page of the original one, but you can move it anywhere else if you would like to do so!\n\n\u003cimg src=\"https://user-images.githubusercontent.com/19658/171324207-d59f3192-9fe5-4979-9b6e-c91fd1d3c934.gif\" width=500 /\u003e\n\n## Prerequisites\n\nTo run this CLI tool, the following are required:\n\n* [Node.js](https://nodejs.org/) runtime for running the CLI (the latest LTS version is recommended)\n* [Notion Internal Integration](https://www.notion.so/my-integrations) for reading and creating Notion pages\n* [DeepL API Free/Pro Account](https://www.deepl.com/pro-api) for translating text in your Notion page blocks\n\n### Notion Internal Integration\n\nYou can configure your integration by the following steps:\n\n* Head to https://www.notion.so/my-integrations\n* Click \"New integration\" button\n* Give an easy-to-understand name (e.g., Notion Translator) to the integration\n* Make sure that you select **Read content** and **Insert content** in the **Content Capabilities** section\n* Make sure that you select **Read user information without email addresses** in the **User Capabilities** section (if you are confident that all the pages that you want to translate do not have any user mentions, **No user information** works too)\n* Click the **Save** button\n\n\u003cimg width=\"300\" src=\"https://user-images.githubusercontent.com/19658/201064269-de4e56ac-11fa-4e5e-a0a4-3e859eed3c43.png\"\u003e\n\nOnce the integration is created, you can find your **Internal Integration Token** under **Secrets** section. The string value should start with `secret_`. You will use this value as `NOTION_API_TOKEN` when configuring the CLI later.\n\n### DeepL API Account\n\nYou can configure your DeepL API account by the following steps:\n\n* Head to https://www.deepl.com/pro-api\n* Create either Free or Pro API account\n\nOnce your account is activated, you can find your DeepL API token on [your account page](https://www.deepl.com/account/summary). YOu will use this value as `DEEPL_API_TOKEN` when configuring the CLI later.\n\n## Configure the CLI\n\nYou can install the CLI via `npm` command.\n\n```bash\nnpm install -g notion-translator\n```\n\nLet's hit `notion-translator  -h` to check if the command is now available for you.\n\n```bash\n$ notion-translator  -h\nUsage: notion-translator [options]\n\nCLI to translate a Notion page to a different language\n\nOptions:\n  -u, --url \u003chttps://www.notion.so/...\u003e\n  -f, --from \u003cbg,cs,da,de,el,en,es,et,fi,fr,hu,id,it,ja,lt,lv,nl,pl,pt,ro,ru,sk,sl,sv,tr,zh\u003e\n  -t, --to \u003cbg,cs,da,de,el,en-gb,en-us,es,et,fi,fr,hu,id,it,ja,lt,lv,nl,pl,pt-pt,pt-br,ro,ru,sk,sl,sv,tr,zh\u003e\n  -d, --debug\n  -h, --help                                                                                                  display help for command\n```\n\nPrior to running the command, set two env variables:\n\n* `NOTION_API_TOKEN`: Notion's Internal Integration Token\n* `DEEPL_API_TOKEN`: DeepL's API token\n\nIf you prefer using `.env` file, it also works as long as the file exists in the current directory.\n\n## Run the CLI Command\n\nPlease don't forget to share the original Notion page with your integration. You can find **Share** link at the top of a Notion page. From there, you can invite your Notion Translator integration to the page.\n\n\u003cimg src=\"https://user-images.githubusercontent.com/19658/171321884-ad911271-8569-449b-9d81-d476d7066cf6.png\" width=300\u003e\n\nOkay, everything should be ready! Let's run the command now :)\n\n```bash\nnotion-translator \\\n  --from en \\\n  --to ja \\\n  --url https://www.notion.so/acme/Blog-Post-ABC123\n```\n\nIf your credentails are not properly set, the CLI opens Notion / DeepL configuration page in the default browser for you. Double-check the settings and token string values.\n\nAlso, if you are unsure about the language code to pass as from/to languages, please refer to [DeepL's official document](https://www.deepl.com/docs-api/translating-text/request/).\n\nI hope that this tool will help you save time!\n\n## Contributions\n\nIf you have any feedback or suggestions to this tool, please feel free to write in in this GitHub repository's issue tracker. Pull requests are welcome too!\n\n## License\n\nThe MIT License\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fseratch%2Fnotion-translator","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fseratch%2Fnotion-translator","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fseratch%2Fnotion-translator/lists"}