Skip to content

felixhaeberle/inlang-plugin-yaml

Repository files navigation

inlang-plugin-yaml

⚠️ OUTDATED - PR TO UPDATE THIS PLUGIN WELCOME

This is a yaml plugin for using translations resources in the yaml format with inlang.

Usage

Plugins can be imported directly from GitHub releases via jsDelivr.

// filename: inlang.config.js

export async function defineConfig(env) {
  const { default: pluginYaml } = await env.$import(
    "https://cdn.jsdelivr.net/gh/felixhaeberle/inlang-plugin-yaml@{version}/dist/index.js"
  );

  return {
    // other properties...
    plugins: [
      pluginYaml({
        pathPattern: "./example/{language}.yml",
      }),
    ],
  };
}

The dist directory is used to distribute the plugin directly via CDN like jsDelivr. Using a CDN works because the inlang config uses dynamic imports to import plugins. Read the jsDelivr documentation on importing from GitHub.

For additional usage information, take a look at example.

Developing

Run the following commands in your terminal (node and npm must be installed):

  1. npm install
  2. npm run dev

npm run dev will start the development environment which automatically compiles the src/index.ts files to JavaScript (dist/index.js), runs tests defined in *.test.ts files and watches changes.

Publishing

  1. Run npm run build to generate a build.
  2. Commit the new build.
  3. Create a new release on GitHub that uses Semantic Versioning (SemVer). Take a look at inlang-plugin-json for example releases.
  4. (Optional) Open a pull request to https://github.com/inlang/ecosystem

Note:

  • tags are used without "v" at the beginning like: New Tag: 1.2.2
  • JSdeliver cached your plugin for one week. If you published a new Version and you want to debug something, you have to specify your version in the link like: [email protected]/dist/index.js"