{"id":21990,"library":"rollup-plugin-drupal-interface-translations","title":"Rollup Plugin Drupal Interface Translations","description":"A Rollup and Vite plugin that extracts Drupal interface translation strings from JavaScript files into .pot (Portable Object Template) files. Currently v1.1.9, stable, with periodic releases. Key differentiator: it integrates Drupal's translation API into modern JavaScript build pipelines, supporting both Rollup and Vite. Unlike manual extraction, it automates generation of translation templates from Drupal's t() and Drupal.t() calls. Based on DrupalTranslationsWebpackPlugin but adapted for Rollup ecosystem.","status":"active","version":"1.1.9","language":"javascript","source_language":"en","source_url":"https://github.com/Exploratorium/rollup-plugin-drupal-interface-translations","tags":["javascript","rollup","rollup-plugin","vite","vite-plugin","drupal"],"install":[{"cmd":"npm install rollup-plugin-drupal-interface-translations","lang":"bash","label":"npm"},{"cmd":"yarn add rollup-plugin-drupal-interface-translations","lang":"bash","label":"yarn"},{"cmd":"pnpm add rollup-plugin-drupal-interface-translations","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Used internally for createFilter to include/exclude files based on filterOptions.","package":"@rollup/pluginutils","optional":false}],"imports":[{"note":"This package is ESM-only. Using require() will throw an error. Must use import syntax.","wrong":"const drupalInterfaceTranslations = require('rollup-plugin-drupal-interface-translations')","symbol":"default","correct":"import drupalInterfaceTranslations from 'rollup-plugin-drupal-interface-translations'"},{"note":"Export is a default export, not named. Named import will result in undefined.","wrong":"import { drupalInterfaceTranslations } from 'rollup-plugin-drupal-interface-translations'","symbol":"drupalInterfaceTranslations","correct":"import drupalInterfaceTranslations from 'rollup-plugin-drupal-interface-translations'"},{"note":"TypeScript type for the plugin is exported as Plugin but users typically import default function. Only needed for type annotations.","wrong":"import { Plugin } from 'rollup-plugin-drupal-interface-translations'","symbol":"Plugin","correct":"import drupalInterfaceTranslations from 'rollup-plugin-drupal-interface-translations'"}],"quickstart":{"code":"import drupalInterfaceTranslations from 'rollup-plugin-drupal-interface-translations';\n\n// https://rollupjs.org/configuration-options/\nexport default {\n  input: 'main.js',\n  plugins: [drupalInterfaceTranslations()],\n};","lang":"javascript","description":"Minimal Rollup configuration to extract Drupal interface translations from main.js, generating a .pot file in translations/ folder."},"warnings":[{"fix":"Use import or configure Node.js to use ESM (e.g., \"type\": \"module\" in package.json).","message":"Package is ESM-only. Using CommonJS require() will throw an error.","severity":"breaking","affected_versions":">=1.0.0"},{"fix":"When using Vite, define plugin inside build.rollupOptions.plugins, not in the top-level plugins array.","message":"Must be added to Vite's rollupOptions.plugins, not root plugins array, or it won't execute correctly.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"","message":"No known deprecated features in current version.","severity":"deprecated","affected_versions":""}],"env_vars":null,"last_verified":"2026-04-27T00:00:00.000Z","next_check":"2026-07-26T00:00:00.000Z","problems":[{"fix":"Change to import drupalInterfaceTranslations from 'rollup-plugin-drupal-interface-translations'","cause":"Using require() on ESM-only package.","error":"TypeError: drupalInterfaceTranslations is not a function"},{"fix":"Use import syntax or upgrade Node to newer version with --experimental-require-module.","cause":"Same as above, require() on ESM package.","error":"Error [ERR_REQUIRE_ESM]: require() of ES Module not supported"},{"fix":"Move plugin to build.rollupOptions.plugins array.","cause":"Plugin works as Rollup plugin and must be placed under build.rollupOptions.plugins in Vite config.","error":"The plugin is not compatible with Vite if placed in root plugins array"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}