0.1.9 • Published 2 years ago

notion-localize v0.1.9

Weekly downloads
-
License
ISC
Repository
github
Last release
2 years ago

use Notion table databse manage localization and translation

  • Status

    npm version downloads

  • Installation

npm i notion-localize
  • Basic usage

Follow this Share a database with your integration to create a Notion table database (inline) and set the integration

The database will be like this:

npm.io

Sync the database to project locale dir:

import NotionLocalize from "notion-localize";

const notionLocalize = new NotionLocalize({
    token: 'your Notion integration token',
    databaseId: 'your notion databse id',
    labelKey: 'optional: label of the databse, default is Label',
    localePath: "optional: locale folder path, eg. './src/locale/$LOCALE/$NAMESPACE.json'"
});

notionLocalize.run();

Get all the keys:

console.log(notionLocalize.keys);

Add some keys to Notion database:

notionLocalize.addTranslationKeys([
    'homepage.title',
    'simpleContent'
]);