Skip to content

NodeJs connector template for Content type app engine

License

Notifications You must be signed in to change notification settings

lokalise/ce-connector-template-node

Repository files navigation

Template connector for Lokalise content type app engines

Lokalise content exchange apps facilitate the exchange of translatable content between Lokalise and third party content platforms. Users interact with them to connect both systems, select the content they want to translate, transfer it to Lokalise, see the translation status, and send the translations back to the content platform.

You can build and publish your own content exchange app by building a connector for the Lokalise content engine. The content engine will take care of the UI and handle the standard install, config and content management flows, while the connector will act as a bridge between the content platform and Lokalise content engine.

 ------------------     -------------------------     ----------------
| Your content app | = | Lokalise content engine | + | Your connector |
 ------------------     -------------------------     ----------------

In this repository you will find TypeScript code that you can use as a template for your Lokalise content exchange connector.

Development

To start development of a new connector:

  1. Copy this repository code to your repository

  2. Replace all entries template with yourConnectorName and Template with YourConnectorName

  3. Start implementing your connector specific logic replacing TODOs. Note that field values in cacheItemStructure of envResponseBody should be in the following format:

    • First letter of the first name word should be capitalized.
      • Wrong: "author"
      • Correct: "Author"
    • First letter of the second, etc word in name should be lower case.
      • Wrong: "Group Name"
      • Correct: "Group name"
    • Concatenated words should be split.
      • Wrong: "GroupName"
      • Correct: "Group name"
    • The field name should be meaningful to the user because it appears on the UI, and it helps users identify their content.

    In response all DateTime fields from cacheItem should be converted in format yyyy-mm-dd.

    • Wrong: fields: {updatedAt: "15.06.2022"}
    • Correct: fields: {updatedAt: "2022-06-15"}
  4. Remove current section from README

Installation

Add .env file to your project root directory based on .env.default.

For development, use the dockerized environment:

npm install
docker compose up -d

The app is available at: http://localhost:3000/ (If HOST_APP_PORT was not changed)

Run tests:

npm run test

Run formatting:

npm run format

Run linter:

npm run lint

Openapi

Openapi docs are available at connector-openapi

License

This library is licensed under the Apache 2.0 license.

Copyright (c) Lokalise.

About

NodeJs connector template for Content type app engine

Topics

Resources

License

Code of conduct

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published