{"id":16266275,"url":"https://github.com/dulnan/drupal-translations-webpack-plugin","last_synced_at":"2025-08-17T20:09:46.015Z","repository":{"id":57216591,"uuid":"150579055","full_name":"dulnan/drupal-translations-webpack-plugin","owner":"dulnan","description":null,"archived":false,"fork":false,"pushed_at":"2023-03-20T22:05:05.000Z","size":58,"stargazers_count":6,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-08-10T08:25:57.706Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/dulnan.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-09-27T11:53:46.000Z","updated_at":"2022-12-08T07:15:51.000Z","dependencies_parsed_at":"2024-10-10T17:40:36.637Z","dependency_job_id":"da0898e1-c0ec-4470-91cc-6e292ce2a4af","html_url":"https://github.com/dulnan/drupal-translations-webpack-plugin","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/dulnan/drupal-translations-webpack-plugin","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dulnan%2Fdrupal-translations-webpack-plugin","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dulnan%2Fdrupal-translations-webpack-plugin/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dulnan%2Fdrupal-translations-webpack-plugin/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dulnan%2Fdrupal-translations-webpack-plugin/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dulnan","download_url":"https://codeload.github.com/dulnan/drupal-translations-webpack-plugin/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dulnan%2Fdrupal-translations-webpack-plugin/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":270899579,"owners_count":24664720,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-08-17T02:00:09.016Z","response_time":129,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-10T17:40:30.515Z","updated_at":"2025-08-17T20:09:45.962Z","avatar_url":"https://github.com/dulnan.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# DrupalTranslationsWebpackPlugin\nExtract Drupal.t and Drupal.formatPlural calls from your webpack bundles.\n\nThe plugin will gather all those calls in one single file and emit them.\nThen you can add this file to your Drupal theme library. Drupal will pick it up\nand run its regex over it, so that those translations end up in the Frontend.\n\nCompatible with Webpack 4 and 5.\n\n# Install\n\nThe plugin is available on npm:\n\n```\nnpm install --save-dev drupal-translations-webpack-plugin\n```\n\n# How to use\n## Add the plugin to your webpack config\n```javascript\nconst DrupalTranslationsWebpackPlugin = require('drupal-translations-webpack-plugin')\n\nplugins: [\n  new DrupalTranslationsWebpackPlugin({\n    output: 'drupal-translations.js'\n  })\n]\n```\n\nYou can use both translation functions everywhere. But *maybe* you need to declare\nthat Drupal is a global object. It worked for me without, in another project it\ndidn't.\n\n*webpack.config.js*\n```javascript\nplugins: [\n  new webpack.ProvidePlugin({\n    'Drupal': 'window.Drupal'\n  })\n]\n```\n\nAlso, if you use ESLint, you want to declare Drupal a global object:\n\n*.eslintrc.js*\n```javascript\nglobals: {\n  'Drupal': true\n}\n```\n\nIt's important that you use the functions like normal, e.g. not write `window.Drupal.t`\nor otherwise wrap them in your own function, etc. The plugin is rather \"dumb\"; it will\njust go through all JS files and parse out the actual \"string\" where the function is\ncalled.\n\nFor a detailled example on how to use this plugin, check out this Drupal webpack example:\n\nhttps://github.com/dulnan/drupal-webpack-setup-example\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdulnan%2Fdrupal-translations-webpack-plugin","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdulnan%2Fdrupal-translations-webpack-plugin","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdulnan%2Fdrupal-translations-webpack-plugin/lists"}