#Build a Plugin

Plugins are a powerful way to extend the functionality of inlang applications. This documentation provides you with the information you need to develop your own plugin.

#Pre-requisites

#Step-by-step

#1. Initialize a new plugin module

npx @inlang/cli@latest module init --type plugin

#2. Implement Plugin Logic

Each of the following functions in the code represents a key aspect of your plugin's functionality:

  • loadMessages: Load messages
  • saveMessages: Save messages
  • addCustomApi: Define app-specific APIs
import type { Plugin, PluginSettings } from "@inlang/plugin"
import { id, displayName, description } from "../marketplace-manifest.json"

export const plugin: Plugin<PluginSettings> = {
	id,
	displayName,
	description,
	loadMessages: async ({ languageTags, sourceLanguageTag, settings, nodeishFs }) => {
		// Plugin's loadMessages logic
	},
	saveMessages: async ({ messages, settings, nodeishFs }) => {
		// Plugin's saveMessages logic
	},
	addCustomApi: ({ settings }) => {},
}

Implement the logic for each function according to your plugin's requirements. Example implementation of plugins can be found here.

#3. Configure your plugin

In your lint rule's marketplace-manifest.json make sure to define the following information:

ParameterDescription
idUnique identifier for your plugin.
iconLink to the icon of your plugin (optional).
galleryOptional gallery, the first image acts as coverImage for your plugin.
displayNameA user-friendly display name for your plugin.
descriptionBriefly describe what your plugin does.
readmeLink to the README documentation for your plugin.
keywordsKeywords that describe your plugin.
publisherNameYour publisher name.
publisherIconLink to your publisher's icon or avatar (optional).
licenseThe license under which your plugin is distributed.
moduleThe path to your plugin's JavaScript module (Please use jsDelivr).

Make sure these settings accurately represent your plugin's purpose and functionality.

#4. Test your plugin

Before publishing your plugin to the marketplace, thoroughly test it to ensure it functions correctly and detects issues as intended.

#5. Publish your plugin

To make your plugin available in the inlang.com marketplace, see Publish on marketplace.

Feel free to join our Discord if you have any questions or need assistance developing and publishing your plugin.




Was this helpful?

Thank you for your feedback ♥️