Skip to content

Exploratorium/rollup-plugin-drupal-interface-translations

Repository files navigation

Rollup Plugin for Drupal to Extract Interface Translations

This is a Rollup plugin that helps you to translation strings in JavaScript that are used in Drupal websites.

Based on DrupalTranslationsWebpackPlugin.

Installation

npm install --save-dev rollup-plugin-drupal-interface-translations

Usage

import drupalInterfaceTranslations from 'rollup-plugin-drupal-interface-translations';

// https://rollupjs.org/configuration-options/
export default {
  input: 'main.js',
  plugins: [drupalInterfaceTranslations()],
};

This plugin can be used with Vite.

import { defineConfig } from 'vite';
import drupalInterfaceTranslations from 'rollup-plugin-drupal-interface-translations';

// https://vitejs.dev/config/
export default defineConfig({
  build: {
    rollupOptions: {
      input: 'main.js',
      plugins: [drupalInterfaceTranslations()],
    },
  },
});

Options

filterOptions

Defines the files that are included in and excluded from interface translation extraction.

There are the parameters for the createFilter function in @rollup/pluginutils.

output

Type : string

Default : "translations/{MODULE_NAME}.pot"

The file path relative of the .pot (portable object template) file that this plugin will generate.


The Exploratorium is a 501(c)(3) nonprofit organization. Our tax ID #: 94-1696494

https://www.exploratorium.edu