Skip to content

Kwintenvdb/notion-deepl

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

notion-deepl

notion-deepl is a CLI tool to translate Notion pages with Deepl

Install

go install github.com/Kwintenvdb/notion-deepl

Overview

You can use this CLI tool to translate Notion pages (or blocks) using the DeepL API.

Requirements

  • Go 1.18+
  • A DeepL API key. A free API subscription is sufficient.
  • A Notion API key. You will need to create your own Notion integration and enable it for the pages you wish to translate.

Limitations

This tool was developed mostly for personal usage. As a result, several limitations exist at this moment:

  • Formatting and rich text markup are mostly not preserved.
  • Databases cannot be translated, though individual database pages can be.
  • Tables cannot be translated.
  • Blocks are currently translated in sequence. This may be further optimized in the future, but is currently limited by Notion's rate-limiting.

Usage

⚠️ This tool will translate your Notion pages or blocks in-place. In other words, the text will be overwritten. If you want to test out the tool, or want to make changes safely, I recommend you make a copy of your page or block first before using this.

Usage:
  notion-deepl [flags]

Flags:
  -b, --block-id string          The Notion block ID to translate (required)
  -d, --deepl-api-key string     DeepL API key (required: if not provided, the DEEPL_API_KEY environment variable will be used)
  -f, --formality string         The formality of the translation (options: default, more, less, prefer_more, prefer_less) (default "default")
  -h, --help                     help for notion-deepl
  -n, --notion-api-key string    Notion API key (required: if not provided, the NOTION_API_KEY environment variable will be used)
  -s, --source-language string   The source language (optional: will be automatically detected for each block if not specified)
  -t, --target-language string   The target language (required)

See the DeepL API docs for which source language and target language options are supported.

The page you want to translate (or blocks within this page) must be connected to your Notion integration before executing the translation. See the Notion docs for how to create and integrate a personal integration with a page.

Examples

Read here for how to get a block ID of a Notion page or block.

Translate a page using API keys from environment variables

notion-deepl --source-language=EN --target-language=NL --block-id=91ada48a2a3b4a939f5e1f0e510c4d3d

Translate a page by specifying API keys and formality via the CLI

notion-deepl --notion-api-key=[YOUR NOTION API KEY]
    --deepl-api-key=[YOUR DEEPL API KEY]
    --source-language=EN
    --target-language=NL
    --block-id=91ada48a2a3b4a939f5e1f0e510c4d3d
    --formality=prefer_less

About

Translate Notion pages with DeepL

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages