Coder Social home page Coder Social logo

notion-translator's Introduction

Notion Translator

npm version

Notion Translator is a CLI tool that enables Notion users to translate Notion pages into a different language by leveraging the DeepL's text translation API.

You can install this tool just by running:

npm install -g notion-translator

How It Works

Let'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:

  • Create a Notion internal integration and save its token as NOTION_API_TOKEN env variable
  • Create a DeepL API account and save its token as DEEPL_API_TOKEN env variable
  • Share the target Notion page with your Notion integration
  • Run the following command to generate a translated page automatically
notion-translator \
  --from en \
  --to ja \
  --url https://www.notion.so/acme/Blog-Post-ABC123

Live Demo

Once 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:

When 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!

Prerequisites

To run this CLI tool, the following are required:

Notion Internal Integration

You can configure your integration by the following steps:

  • Head to https://www.notion.so/my-integrations
  • Click "New integration" button
  • Give an easy-to-understand name (e.g., Notion Translator) to the integration
  • Make sure that you select Read content and Insert content in the Content Capabilities section
  • 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)
  • Click the Save button

Once 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.

DeepL API Account

You can configure your DeepL API account by the following steps:

Once your account is activated, you can find your DeepL API token on your account page. YOu will use this value as DEEPL_API_TOKEN when configuring the CLI later.

Configure the CLI

You can install the CLI via npm command.

npm install -g notion-translator

Let's hit notion-translator -h to check if the command is now available for you.

$ notion-translator  -h
Usage: notion-translator [options]

CLI to translate a Notion page to a different language

Options:
  -u, --url <https://www.notion.so/...>
  -f, --from <bg,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>
  -t, --to <bg,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>
  -d, --debug
  -h, --help                                                                                                  display help for command

Prior to running the command, set two env variables:

  • NOTION_API_TOKEN: Notion's Internal Integration Token
  • DEEPL_API_TOKEN: DeepL's API token

If you prefer using .env file, it also works as long as the file exists in the current directory.

Run the CLI Command

Please 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.

Okay, everything should be ready! Let's run the command now :)

notion-translator \
  --from en \
  --to ja \
  --url https://www.notion.so/acme/Blog-Post-ABC123

If 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.

Also, if you are unsure about the language code to pass as from/to languages, please refer to DeepL's official document.

I hope that this tool will help you save time!

Contributions

If 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!

License

The MIT License

notion-translator's People

Contributors

alfqontrol avatar seratch avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

notion-translator's Issues

what do these errors mean?

Fir of all, I want to thank the developers of notion-translator, it's been a time saver for me.

about my errors:
I keep getting this error every now and then. I'd appreciate it if someone can show me how to fix this error.

body.parent.database_id should be defined, instead was `undefined`.
body.icon.emoji should be defined, instead was `undefined`.
body.icon.external should be defined, instead was `undefined`.

400 validation error when createNewPageForTranslation

Gist

Seem to create the empty page but then fails with a 400 validation error.
Might be something connected to Notion API changes (error is obviously from Notion API).
It creates a page but then fails to fill it with elements.

I tried debugging myself but I'm not good at JS + don't really know how to debug CLIs.

I think it should be something simple. Perhaps some condition needed to ignore empty blocks.
Judging from the output, the error is in one particular child block.

Inputs

ru → en-us
Page for translation (accessible via [email protected])

Output

Last login: Wed Nov  9 16:43:23 on ttys000
bash: brew: command not found

The default interactive shell is now zsh.
To update your account to use zsh, please run `chsh -s /bin/zsh`.
For more details, please visit https://support.apple.com/kb/HT208050.
pavzagor-Macbook-pro-14:~ pavelzagorodnikh$ notion-translator -f ru -t en-us -u https://www.notion.so/kodland/Magic-of-code-with-Scratch-M4L4-20-1-83e1a53899e14019ae1a50553cd318f0

Wait a minute! Now translating the following Notion page:
https://www.notion.so/kodland/Magic-of-code-with-Scratch-M4L4-20-1-83e1a53899e14019ae1a50553cd318f0

(this may take some time) ....................................../opt/homebrew/lib/node_modules/notion-translator/node_modules/@notionhq/client/build/src/errors.js:162
        return new APIResponseError({
               ^

APIResponseError: body failed validation. Fix one:
body.children[28].embed should be defined, instead was `undefined`.
body.children[28].bookmark should be defined, instead was `undefined`.
body.children[28].image should be defined, instead was `undefined`.
body.children[28].video should be defined, instead was `undefined`.
body.children[28].pdf should be defined, instead was `undefined`.
body.children[28].file should be defined, instead was `undefined`.
body.children[28].audio should be defined, instead was `undefined`.
body.children[28].code should be defined, instead was `undefined`.
body.children[28].equation should be defined, instead was `undefined`.
body.children[28].divider should be defined, instead was `undefined`.
body.children[28].breadcrumb should be defined, instead was `undefined`.
body.children[28].table_of_contents should be defined, instead was `undefined`.
body.children[28].link_to_page should be defined, instead was `undefined`.
body.children[28].table_row should be defined, instead was `undefined`.
body.children[28].column_list should be defined, instead was `undefined`.
body.children[28].column should be defined, instead was `undefined`.
body.children[28].table should be defined, instead was `undefined`.
body.children[28].heading_1 should be defined, instead was `undefined`.
body.children[28].heading_2 should be defined, instead was `undefined`.
body.children[28].heading_3 should be defined, instead was `undefined`.
body.children[28].paragraph should be defined, instead was `undefined`.
body.children[28].bulleted_list_item should be defined, instead was `undefined`.
body.children[28].numbered_list_item should be defined, instead was `undefined`.
body.children[28].quote should be defined, instead was `undefined`.
body.children[28].to_do should be defined, instead was `undefined`.
body.children[28].toggle should be defined, instead was `undefined`.
body.children[28].template should be defined, instead was `undefined`.
body.children[28].callout should be defined, instead was `undefined`.
body.children[28].synced_block should be defined, instead was `undefined`.
    at buildRequestError (/opt/homebrew/lib/node_modules/notion-translator/node_modules/@notionhq/client/build/src/errors.js:162:16)
    at Client.request (/opt/homebrew/lib/node_modules/notion-translator/node_modules/@notionhq/client/build/src/Client.js:304:54)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async /opt/homebrew/lib/node_modules/notion-translator/index.js:396:26 {
  code: 'validation_error',
  status: 400,
  headers: Headers {
    [Symbol(map)]: [Object: null prototype] {
      date: [ 'Wed, 09 Nov 2022 14:17:20 GMT' ],
      'content-type': [ 'application/json; charset=utf-8' ],
      'transfer-encoding': [ 'chunked' ],
      connection: [ 'close' ],
      'set-cookie': [
        'notion_browser_id=some_id; Domain=www.notion.so; Path=/; Expires=Thu, 09 Nov 2023 14:17:19 GMT; Secure',
        'notion_check_cookie_consent=true; Domain=www.notion.so; Path=/; Expires=Thu, 10 Nov 2022 14:17:19 GMT; Secure'
      ],
      'content-security-policy': [
        "script-src 'self' 'unsafe-inline' 'unsafe-eval' https://gist.github.com https://apis.google.com https://www.google.com https://www.gstatic.com https://cdn.amplitude.com https://api.amplitude.com https://hkfxbbdzib.notion.so https://widget.intercom.io https://js.intercomcdn.com https://static.zdassets.com https://api.smooch.io\t https://logs-01.loggly.com https://http-inputs-notion.splunkcloud.com https://cdn.segment.com https://analytics.pgncs.notion.so https://o324374.ingest.sentry.io https://checkout.stripe.com https://js.stripe.com https://embed.typeform.com https://admin.typeform.com https://public.profitwell.com js.sentry-cdn.com https://js.chilipiper.com https://platform.twitter.com https://cdn.syndication.twimg.com https://accounts.google.com https://www.googletagmanager.com https://www.googleadservices.com https://googleads.g.doubleclick.net https://api-v2.mutinyhq.io https://client-registry.mutinycdn.com https://client.mutinycdn.com https://user-data.mutinycdn.com https://metadata-static-files.sfo2.cdn.digitaloceanspaces.com https://platformapi.metadata.io https://cdn01.boxcdn.net;connect-src 'self' https://msgstore.www.notion.so wss://msgstore.www.notion.so ws://localhost:* ws://127.0.0.1:* https://notion-emojis.s3-us-west-2.amazonaws.com https://s3-us-west-2.amazonaws.com https://s3.us-west-2.amazonaws.com https://notion-production-snapshots-2.s3.us-west-2.amazonaws.com https://cdn.amplitude.com https://api.amplitude.com https://hkfxbbdzib.notion.so https://www.notion.so https://api.embed.ly https://js.intercomcdn.com https://api-iam.intercom.io https://uploads.intercomcdn.com wss://nexus-websocket-a.intercom.io https://ekr.zdassets.com https://ekr.zendesk.com\t https://makenotion.zendesk.com\t https://api.smooch.io\t wss://api.smooch.io\t https://logs-01.loggly.com https://http-inputs-notion.splunkcloud.com https://cdn.segment.com https://api.segment.io https://analytics.pgncs.notion.so https://api.pgncs.notion.so https://o324374.ingest.sentry.io https://checkout.stripe.com https://js.stripe.com https://cdn.contentful.com https://preview.contentful.com https://images.ctfassets.net https://www2.profitwell.com https://tracking.chilipiper.com https://api.chilipiper.com https://api.unsplash.com https://boards-api.greenhouse.io https://accounts.google.com https://oauth2.googleapis.com https://www.googletagmanager.com https://analytics.google.com https://www.googleadservices.com https://googleads.g.doubleclick.net https://region1.google-analytics.com https://region1.analytics.google.com https://www.google-analytics.com https://api-v2.mutinyhq.io https://client-registry.mutinycdn.com https://client.mutinycdn.com https://user-data.mutinycdn.com https://metadata-static-files.sfo2.cdn.digitaloceanspaces.com https://platformapi.metadata.io https://api.statuspage.io https://pgncd.notion.so https://api.statsig.com https://statsigapi.net https://exp.notion.so https://file.notion.so https://api.box.com;font-src 'self' data: https://cdnjs.cloudflare.com https://js.intercomcdn.com https://cdn01.boxcdn.net;img-src 'self' data: blob: https: https://platform.twitter.com https://syndication.twitter.com https://pbs.twimg.com https://ton.twimg.com https://region1.google-analytics.com https://region1.analytics.google.com;style-src 'self' 'unsafe-inline' https://cdnjs.cloudflare.com https://github.githubassets.com https://js.chilipiper.com https://platform.twitter.com https://ton.twimg.com https://accounts.google.com https://cdn01.boxcdn.net;frame-src https: http: https://accounts.google.com;media-src https: http: https://file.notion.so"
      ],
      'x-dns-prefetch-control': [ 'off' ],
      'x-frame-options': [ 'SAMEORIGIN' ],
      'strict-transport-security': [ 'max-age=5184000; includeSubDomains' ],
      'x-download-options': [ 'noopen' ],
      'x-content-type-options': [ 'nosniff' ],
      'x-permitted-cross-domain-policies': [ 'none' ],
      'referrer-policy': [ 'strict-origin-when-cross-origin' ],
      'x-xss-protection': [ '0' ],
      etag: [ 'W/"895-wGCgVAkQCsyYKFvOSpC/PhmY/jI"' ],
      vary: [ 'Accept-Encoding' ],
      'content-encoding': [ 'gzip' ],
      'cf-cache-status': [ 'DYNAMIC' ],
      server: [ 'cloudflare' ],
      'cf-ray': [ '76772bda88c26249-OTP' ]
    }
  },
  body: '{"object":"error","status":400,"code":"validation_error","message":"body failed validation. Fix one:\\nbody.children[28].embed should be defined, instead was `undefined`.\\nbody.children[28].bookmark should be defined, instead was `undefined`.\\nbody.children[28].image should be defined, instead was `undefined`.\\nbody.children[28].video should be defined, instead was `undefined`.\\nbody.children[28].pdf should be defined, instead was `undefined`.\\nbody.children[28].file should be defined, instead was `undefined`.\\nbody.children[28].audio should be defined, instead was `undefined`.\\nbody.children[28].code should be defined, instead was `undefined`.\\nbody.children[28].equation should be defined, instead was `undefined`.\\nbody.children[28].divider should be defined, instead was `undefined`.\\nbody.children[28].breadcrumb should be defined, instead was `undefined`.\\nbody.children[28].table_of_contents should be defined, instead was `undefined`.\\nbody.children[28].link_to_page should be defined, instead was `undefined`.\\nbody.children[28].table_row should be defined, instead was `undefined`.\\nbody.children[28].column_list should be defined, instead was `undefined`.\\nbody.children[28].column should be defined, instead was `undefined`.\\nbody.children[28].table should be defined, instead was `undefined`.\\nbody.children[28].heading_1 should be defined, instead was `undefined`.\\nbody.children[28].heading_2 should be defined, instead was `undefined`.\\nbody.children[28].heading_3 should be defined, instead was `undefined`.\\nbody.children[28].paragraph should be defined, instead was `undefined`.\\nbody.children[28].bulleted_list_item should be defined, instead was `undefined`.\\nbody.children[28].numbered_list_item should be defined, instead was `undefined`.\\nbody.children[28].quote should be defined, instead was `undefined`.\\nbody.children[28].to_do should be defined, instead was `undefined`.\\nbody.children[28].toggle should be defined, instead was `undefined`.\\nbody.children[28].template should be defined, instead was `undefined`.\\nbody.children[28].callout should be defined, instead was `undefined`.\\nbody.children[28].synced_block should be defined, instead was `undefined`."}'
}

Node.js v19.0.1

Cannot read properties of undefined (reading 'title')

Hello again ;)

first of all: Thanks for this blazing fast bugfix today, that seems to work.

Now I found this error-message:

C:\Users\user1\Documents\NotionTranslator>notion-translator --from en --to id --url https://www.notion.so/MyNotionPage

Wait a minute! Now translating the following Notion page:
https://www.notion.so/MyNotionPage

(this may take some time) ...........C:\Users\user1\AppData\Roaming\npm\node_modules\notion-translator\index.js:376
  const newTitle = newPage.properties.title.title[0];
                                            ^

TypeError: Cannot read properties of undefined (reading 'title')
    at createNewPageForTranslation (C:\Users\user1\AppData\Roaming\npm\node_modules\notion-translator\index.js:376:45)
    at C:\Users\user1\AppData\Roaming\npm\node_modules\notion-translator\index.js:421:25
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)

Node.js v20.8.0

Error 400

Hi,

First of all thank you for this code! I did everything necessary but as soon as I run the command I have this error message
body: '{"object":"error","status":400,"code":"validation_error","message":"body failed validation. Fix one:\nbody.parent.database_id should be defined, instead was undefined.\nbody.cover.external should be defined, instead was undefined."}'
}

Can you help me ?

Thx

Table and notion api limit

Hi, awesome tool, thanks!

I translated a notion page from EN to JA and the tool didn't translate text in table. In Japanese I get the following result on the created page: (このページでは画像を削除しています) // (This page removes the table)

Also only a fraction of the page has been translated: (申し訳ありません。Notion-translatorはNotion公開APIの制限により、以下のブロックを全て省略させていただきました。) // (Sorry, Notion-translator omits all of the following blocks due to limitations of the Notion public API.)

Can it be fixed?

Image blocks do not work in a copied page

First of all, thanks a lot for that very useful package, it will save us a lot of time and sweat 🙏

I just tried to use it on a page with an image but I'm getting the following error:

  body: '{"object":"error","status":400,"code":"validation_error","message":"body failed validation: body.children[7].image.external should be defined, instead was `undefined`."}'

I tried to add a statement to read the type === "image" but after digging a bit, it looks like I can't copy an image since the image URL is now expirable ( https://twitter.com/notionhq/status/1463669460938760198?lang=en )

Adding that block as a workaround prevent the script from crashing but I was really hopping to be able to copy the image:

      if (b.type === "image") {
        // The image blocks do not work in a copied page
        const notice = [
          {
            plain_text: "(The image was removed from this page)",
            text: { content: "" },
          },
        ];
        await translateText(notice, "en", to);
        b = {
          type: "paragraph",
          paragraph: {
            color: "default",
            rich_text: notice,
          },
        };
      }

From my understanding, I can't copy the image because I can't fetch then re-upload the image.

We don't currently support uploading files to Notion through the API

https://developers.notion.com/reference/file-object

My ticket is to:

  1. let you be aware of that issue
  2. hopping you would figure out a solution I didn't think about 🤞

trouble defining the parent.database_id and cover.external

Based on the error message, it seems like there is an issue with the notion-translator tool when creating a new translated page in the Notion database. The error indicates that the script is having trouble defining the parent.database_id and cover.external properties when creating the new page.

Here the issue from the terminal:

"APIResponseError: body failed validation. Fix one:
body.parent.database_id should be defined, instead was `undefined`.
body.cover.external should be defined, instead was `undefined`.
    at buildRequestError (/Users/niko/NotionDeepl/notion-translator-main/node_modules/@notionhq/client/build/src/errors.js:162:16)
    at Client.request (/Users/niko/NotionDeepl/notion-translator-main/node_modules/@notionhq/client/build/src/Client.js:304:54)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async createNewPageForTranslation (/Users/niko/NotionDeepl/notion-translator-main/index.js:391:27)
    at async /Users/niko/NotionDeepl/notion-translator-main/index.js:426:19 {
  code: 'validation_error',
  status: 400,
  headers: Headers {
    [Symbol(map)]: [Object: null prototype] {
      date: [ 'Sun, 26 Mar 2023 16:11:30 GMT' ],
      'content-type': [ 'application/json; charset=utf-8' ],
      'content-length': [ '236' ],
      connection: [ 'close' ],
      'set-cookie': [
        'notion_browser_id=b11f3ded-67b1-4e4b-ad47-d5e36867d58d; Domain=www.notion.so; Path=/; Expires=Mon, 25 Mar 2024 16:11:30 GMT; Secure',
        'notion_check_cookie_consent=true; Domain=www.notion.so; Path=/; Expires=Mon, 27 Mar 2023 16:11:30 GMT; Secure',
        '__cf_bm=yFYSN9yx_uuFy.ar3p3yyT6QI2We1A9K8Lbc88IlSMg-1679847090-0-AeR+uPi7wDTixgYjiQHF61vwRzRn1ClqP1SdkPpgcM9eLMKSSDinssX2XtKA1oMsZ9OgsvSJ7U1qlHG0I7xF30I=; path=/; expires=Sun, 26-Mar-23 16:41:30 GMT; domain=.notion.com; HttpOnly; Secure; SameSite=None'
      ],
      'content-security-policy': [
        "script-src 'self' 'unsafe-inline' 'unsafe-eval' https://gist.github.com https://apis.google.com https://cdn.amplitude.com https://api.amplitude.com http://dev-embed.notion.co http://embed.notion.co https://widget.intercom.io https://js.intercomcdn.com https://static.zdassets.com https://api.smooch.io\t https://logs-01.loggly.com https://http-inputs-notion.splunkcloud.com https://cdn.segment.com https://analytics.pgncs.notion.so https://o324374.ingest.sentry.io https://checkout.stripe.com https://js.stripe.com https://embed.typeform.com https://admin.typeform.com https://public.profitwell.com https://static.profitwell.com js.sentry-cdn.com https://js.chilipiper.com https://platform.twitter.com https://cdn.syndication.twimg.com https://accounts.google.com https://www.googletagmanager.com https://www.googleadservices.com https://googleads.g.doubleclick.net https://api-v2.mutinyhq.io https://client-registry.mutinycdn.com https://client.mutinycdn.com https://user-data.mutinycdn.com https://cdn.metadata.io https://platformapi.metadata.io https://d2hrivdxn8ekm8.cloudfront.net https://d1lu3pmaz2ilpx.cloudfront.net https://dvqigh9b7wa32.cloudfront.net https://d330aiyvva2oww.cloudfront.net https://cdn.transcend.io https://cdn01.boxcdn.net https://cdn.sprig.com assets.customer.io code.gist.build https://www.google.com https://www.gstatic.com https://challenges.cloudflare.com;connect-src 'self' data: blob: https://msgstore.www.notion.so wss://msgstore.www.notion.so ws://localhost:* ws://127.0.0.1:* https://notion-emojis.s3-us-west-2.amazonaws.com https://s3-us-west-2.amazonaws.com https://s3.us-west-2.amazonaws.com https://notion-production-snapshots-2.s3.us-west-2.amazonaws.com https://cdn.amplitude.com https://api.amplitude.com https://www.notion.so https://api.embed.ly http://dev-embed.notion.co http://embed.notion.co https://js.intercomcdn.com https://api-iam.intercom.io https://uploads.intercomcdn.com wss://nexus-websocket-a.intercom.io https://ekr.zdassets.com https://ekr.zendesk.com\t https://makenotion.zendesk.com\t https://api.smooch.io\t wss://api.smooch.io\t https://logs-01.loggly.com https://http-inputs-notion.splunkcloud.com https://cdn.segment.com https://api.segment.io https://analytics.pgncs.notion.so https://api.pgncs.notion.so https://o324374.ingest.sentry.io https://checkout.stripe.com https://js.stripe.com https://cdn.contentful.com https://preview.contentful.com https://images.ctfassets.net https://www2.profitwell.com https://tracking.chilipiper.com https://api.chilipiper.com https://api.unsplash.com https://boards-api.greenhouse.io https://accounts.google.com https://oauth2.googleapis.com https://www.googletagmanager.com https://analytics.google.com https://www.googleadservices.com https://googleads.g.doubleclick.net https://region1.google-analytics.com https://region1.analytics.google.com https://www.google-analytics.com https://api-v2.mutinyhq.io https://client-registry.mutinycdn.com https://client.mutinycdn.com https://user-data.mutinycdn.com https://cdn.metadata.io https://platformapi.metadata.io https://d2hrivdxn8ekm8.cloudfront.net https://d1lu3pmaz2ilpx.cloudfront.net https://dvqigh9b7wa32.cloudfront.net https://d330aiyvva2oww.cloudfront.net https://cdn.transcend.io https://telemetry.transcend.io https://api.statuspage.io https://pgncd.notion.so https://api.statsig.com https://statsigapi.net https://exp.notion.so https://file.notion.so notion://file.notion.so https://api.box.com https://*.mux.com https://api.sprig.com https://storage.googleapis.com https://cdn.sprig.com https://cdn.userleap.com track.customer.io *.api.gist.build *.cloud.gist.build;font-src 'self' data: https://cdnjs.cloudflare.com https://js.intercomcdn.com https://cdn01.boxcdn.net;img-src 'self' data: blob: https: https://platform.twitter.com https://syndication.twitter.com https://pbs.twimg.com https://ton.twimg.com https://region1.google-analytics.com https://region1.analytics.google.com https://file.notion.so notion://file.notion.so https://*.mux.com track.customer.io;style-src 'self' 'unsafe-inline' https://cdnjs.cloudflare.com https://github.githubassets.com https://js.chilipiper.com https://platform.twitter.com https://ton.twimg.com https://accounts.google.com https://cdn.transcend.io https://cdn01.boxcdn.net code.gist.build;media-src blob: https: http: https://file.notion.so notion://file.notion.so https://*.mux.com;worker-src blob:;frame-src https: http: https://accounts.google.com renderer.gist.build code.gist.build https://challenges.cloudflare.com"
      ],
      'x-dns-prefetch-control': [ 'off' ],
      'x-frame-options': [ 'SAMEORIGIN' ],
      'strict-transport-security': [ 'max-age=5184000; includeSubDomains' ],
      'x-download-options': [ 'noopen' ],
      'x-content-type-options': [ 'nosniff' ],
      'x-permitted-cross-domain-policies': [ 'none' ],
      'referrer-policy': [ 'strict-origin-when-cross-origin' ],
      'x-xss-protection': [ '0' ],
      etag: [ 'W/"ec-EhHVZ1tON7w2DDfjFYqnQsN7EIs"' ],
      vary: [ 'Accept-Encoding' ],
      'cf-cache-status': [ 'DYNAMIC' ],
      server: [ 'cloudflare' ],
      'cf-ray': [ '7ae0ab7559531621-DUS' ]
    }
  },
  body: '{"object":"error","status":400,"code":"validation_error","message":"body failed validation. Fix one:\\nbody.parent.database_id should be defined, instead was `undefined`.\\nbody.cover.external should be defined, instead was `undefined`."}'
}

Error: ERR_REQUIRE_ESM

Hello,
I am trying to use your cool plugin, but I get this error while invoking the translate-command:

C:\Users\user1>notion-translator --from en --to id --url https://www.notion.so/mynotionsite
C:\Users\user1\AppData\Roaming\npm\node_modules\notion-translator\index.js:12
const open = require("open");
             ^

Error [ERR_REQUIRE_ESM]: require() of ES Module C:\Users\user1\AppData\Roaming\npm\node_modules\notion-translator\node_modules\open\index.js from C:\Users\user1\AppData\Roaming\npm\node_modules\notion-translator\index.js not supported.
Instead change the require of C:\Users\user1\AppData\Roaming\npm\node_modules\notion-translator\node_modules\open\index.js in C:\Users\user1\AppData\Roaming\npm\node_modules\notion-translator\index.js to a dynamic import() which is available in all CommonJS modules.
    at Object.<anonymous> (C:\Users\user1\AppData\Roaming\npm\node_modules\notion-translator\index.js:12:14) {
  code: 'ERR_REQUIRE_ESM'
}

Node.js v20.8.0

I am using the newest version of the notion-translator package with a fresh install.

Any ideas how I can fix it?

  • Nodejs reinstalled
  • npm reinstalled
  • deleted npm cache

Thank you ;)

does not translate

Hello,

I managed to install the code, everything is going well but the problem is that when the command has finished executing, it sends me to the page in question but it does not translate

Can you help me ?

Thx

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.