{"id":16347760,"url":"https://github.com/privatenumber/webpack-localize-assets-plugin","last_synced_at":"2025-09-22T04:00:15.211Z","repository":{"id":42522329,"uuid":"365976372","full_name":"privatenumber/webpack-localize-assets-plugin","owner":"privatenumber","description":"🌐 Localize your Webpack bundle with multiple locales","archived":false,"fork":false,"pushed_at":"2024-03-22T22:24:08.000Z","size":526,"stargazers_count":41,"open_issues_count":9,"forks_count":7,"subscribers_count":4,"default_branch":"develop","last_synced_at":"2025-04-03T15:21:48.970Z","etag":null,"topics":["assets","i18n","internationalization","internationalize","localization","localize","multi-language","plugin","webpack"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","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/privatenumber.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},"funding":{"github":"privatenumber"}},"created_at":"2021-05-10T08:47:40.000Z","updated_at":"2025-03-10T04:04:39.000Z","dependencies_parsed_at":"2024-10-28T09:24:42.483Z","dependency_job_id":null,"html_url":"https://github.com/privatenumber/webpack-localize-assets-plugin","commit_stats":{"total_commits":102,"total_committers":4,"mean_commits":25.5,"dds":0.08823529411764708,"last_synced_commit":"3af0283a3ddd96e11248a6c23dd049988120740d"},"previous_names":[],"tags_count":19,"template":false,"template_full_name":null,"purl":"pkg:github/privatenumber/webpack-localize-assets-plugin","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/privatenumber%2Fwebpack-localize-assets-plugin","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/privatenumber%2Fwebpack-localize-assets-plugin/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/privatenumber%2Fwebpack-localize-assets-plugin/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/privatenumber%2Fwebpack-localize-assets-plugin/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/privatenumber","download_url":"https://codeload.github.com/privatenumber/webpack-localize-assets-plugin/tar.gz/refs/heads/develop","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/privatenumber%2Fwebpack-localize-assets-plugin/sbom","scorecard":{"id":745568,"data":{"date":"2025-08-11","repo":{"name":"github.com/privatenumber/webpack-localize-assets-plugin","commit":"0f733ef0fd56adaf691c28f3b61cc9f9c8ea8118"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":2.5,"checks":[{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Dangerous-Workflow","score":10,"reason":"no dangerous workflow patterns detected","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Code-Review","score":0,"reason":"Found 0/30 approved changesets -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Pinned-Dependencies","score":0,"reason":"dependency not pinned by hash detected -- score normalized to 0","details":["Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/release.yml:14: update your workflow using https://app.stepsecurity.io/secureworkflow/privatenumber/webpack-localize-assets-plugin/release.yml/develop?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/release.yml:17: update your workflow using https://app.stepsecurity.io/secureworkflow/privatenumber/webpack-localize-assets-plugin/release.yml/develop?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/release.yml:22: update your workflow using https://app.stepsecurity.io/secureworkflow/privatenumber/webpack-localize-assets-plugin/release.yml/develop?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/test.yml:15: update your workflow using https://app.stepsecurity.io/secureworkflow/privatenumber/webpack-localize-assets-plugin/test.yml/develop?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/test.yml:18: update your workflow using https://app.stepsecurity.io/secureworkflow/privatenumber/webpack-localize-assets-plugin/test.yml/develop?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/test.yml:23: update your workflow using https://app.stepsecurity.io/secureworkflow/privatenumber/webpack-localize-assets-plugin/test.yml/develop?enable=pin","Info:   0 out of   4 GitHub-owned GitHubAction dependencies pinned","Info:   0 out of   2 third-party GitHubAction dependencies pinned"],"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"Token-Permissions","score":0,"reason":"detected GitHub workflow tokens with excessive permissions","details":["Warn: no topLevel permission defined: .github/workflows/release.yml:1","Warn: no topLevel permission defined: .github/workflows/test.yml:1","Info: no jobLevel write permissions found"],"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Info: FSF or OSI recognized license: MIT License: LICENSE:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'develop'","Warn: branch protection not enabled for branch 'master'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"SAST","score":0,"reason":"SAST tool is not run on all commits -- score normalized to 0","details":["Warn: 0 commits out of 3 are checked with a SAST tool"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}},{"name":"Vulnerabilities","score":0,"reason":"30 existing vulnerabilities detected","details":["Warn: Project is vulnerable to: GHSA-v6h2-p8h4-qcjw","Warn: Project is vulnerable to: GHSA-grv7-fg5c-xmjg","Warn: Project is vulnerable to: GHSA-x9w5-v3q2-3rhw","Warn: Project is vulnerable to: GHSA-3xgq-45jj-v275","Warn: Project is vulnerable to: GHSA-w573-4hg7-7wgq","Warn: Project is vulnerable to: GHSA-434g-2637-qmqr","Warn: Project is vulnerable to: GHSA-49q7-c7j4-3p7m","Warn: Project is vulnerable to: GHSA-977x-g7h5-7qgw","Warn: Project is vulnerable to: GHSA-f7q4-pwc6-w24p","Warn: Project is vulnerable to: GHSA-fc9h-whq2-v747","Warn: Project is vulnerable to: GHSA-vjh7-7g9h-fjfh","Warn: Project is vulnerable to: GHSA-67mh-4wv8-2f99","Warn: Project is vulnerable to: GHSA-9c47-m6qq-7p4h","Warn: Project is vulnerable to: GHSA-76p3-8jx3-jpfq","Warn: Project is vulnerable to: GHSA-3rfm-jhwj-7488","Warn: Project is vulnerable to: GHSA-hhq3-ff78-jv3g","Warn: Project is vulnerable to: GHSA-952p-6rrq-rcjv","Warn: Project is vulnerable to: GHSA-qrpm-p2h7-hrv2","Warn: Project is vulnerable to: GHSA-mwcw-c2x4-8c55","Warn: Project is vulnerable to: GHSA-h7cp-r72f-jxh6","Warn: Project is vulnerable to: GHSA-v62p-rq8g-8h59","Warn: Project is vulnerable to: GHSA-7fh5-64p2-3v2j","Warn: Project is vulnerable to: GHSA-gcx4-mw62-g8wm","Warn: Project is vulnerable to: GHSA-c2qf-rxjj-qqgw","Warn: Project is vulnerable to: GHSA-76p7-773f-r4q5","Warn: Project is vulnerable to: GHSA-4wf5-vphf-c2xc","Warn: Project is vulnerable to: GHSA-hc6q-2mpp-qw7j","Warn: Project is vulnerable to: GHSA-4vvj-4cpr-p986","Warn: Project is vulnerable to: GHSA-j8xg-fqg3-53r7","Warn: Project is vulnerable to: GHSA-f9xv-q969-pqx4"],"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}}]},"last_synced_at":"2025-08-22T18:36:09.559Z","repository_id":42522329,"created_at":"2025-08-22T18:36:09.559Z","updated_at":"2025-08-22T18:36:09.559Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":276342544,"owners_count":25625581,"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-09-22T02:00:08.972Z","response_time":79,"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":["assets","i18n","internationalization","internationalize","localization","localize","multi-language","plugin","webpack"],"created_at":"2024-10-11T00:45:50.118Z","updated_at":"2025-09-22T04:00:14.918Z","avatar_url":"https://github.com/privatenumber.png","language":"TypeScript","funding_links":["https://github.com/sponsors/privatenumber"],"categories":[],"sub_categories":[],"readme":"# webpack-localize-assets-plugin \u003ca href=\"https://npm.im/webpack-localize-assets-plugin\"\u003e\u003cimg src=\"https://badgen.net/npm/v/webpack-localize-assets-plugin\"\u003e\u003c/a\u003e \u003ca href=\"https://npm.im/webpack-localize-assets-plugin\"\u003e\u003cimg src=\"https://badgen.net/npm/dm/webpack-localize-assets-plugin\"\u003e\u003c/a\u003e \u003ca href=\"https://packagephobia.now.sh/result?p=webpack-localize-assets-plugin\"\u003e\u003cimg src=\"https://packagephobia.now.sh/badge?p=webpack-localize-assets-plugin\"\u003e\u003c/a\u003e\n\nLocalization (i18n) plugin for Webpack. Supports multiple locales.\n\n\u003cp align=\"center\"\u003e\n\t\u003cbr\u003e\u003cbr\u003e\n\t\u003cimg width=\"300\" src=\"https://stackoverflow.design/assets/img/logos/so/logo-stackoverflow.svg\"\u003e\n\t\u003cbr\u003e\u003cbr\u003e\n\t\u003ca href=\"https://github.com/privatenumber/webpack-localize-assets-plugin/issues/20#issuecomment-989298413\"\u003e\n\t\tUsed by \u003cem\u003eStackOverflow.com\u003c/em\u003e\n\t\u003c/a\u003e\n\u003c/p\u003e\n\n### Features\n- Create bundles with localization baked in\n- Suports single \u0026 multiple locales\n- Blazing fast!\n\n_How does it compare to [i18n-webpack-plugin](https://github.com/webpack-contrib/i18n-webpack-plugin)?_ Answered in the [FAQ](#how-does-this-compare-to-i18n-webpack-plugin).\n\n\u003cbr\u003e\n\n\u003cp align=\"center\"\u003e\n\t\u003ca href=\"https://privatenumber-sponsors.vercel.app/api/sponsor?tier=platinum\"\u003e\n\t\t\u003cpicture\u003e\n\t\t\t\u003csource width=\"830\" media=\"(prefers-color-scheme: dark)\" srcset=\"https://privatenumber-sponsors.vercel.app/api/sponsor?tier=platinum\u0026image=dark\"\u003e\n\t\t\t\u003csource width=\"830\" media=\"(prefers-color-scheme: light)\" srcset=\"https://privatenumber-sponsors.vercel.app/api/sponsor?tier=platinum\u0026image\"\u003e\n\t\t\t\u003cimg width=\"830\" src=\"https://privatenumber-sponsors.vercel.app/api/sponsor?tier=platinum\u0026image\" alt=\"Premium sponsor banner\"\u003e\n\t\t\u003c/picture\u003e\n\t\u003c/a\u003e\n\u003c/p\u003e\n\n## 🚀 Install\n```sh\nnpm i -D webpack-localize-assets-plugin\n```\n\n## 🚦 Quick setup\n\n- Import `webpack-localize-assets-plugin`.\n- Include `[locale]` in `output.filename` to indicate where the locale name should go in the output file.\n- Register `webpack-localize-assets-plugin` with `locales` passed in.\n\nIn `webpack.config.js`:\n\n```diff\n+ const LocalizeAssetsPlugin = require('webpack-localize-assets-plugin')\n\n  const locales = {\n      en: { ... },\n      es: { ... },\n      ja: { ... },\n      ...\n  }\n\n  module.exports = {\n      ...,\n\n      output: {\n+         filename: '[name].[locale].js',\n          ...\n      },\n\n      plugins: [\n          ...,\n+         new LocalizeAssetsPlugin({\n+             locales\n+         })\n      ]\n  }\n```\n\n\n## ⚙️ Options\n#### locales\nRequired\n\nType:\n```ts\ntype Locales = {\n    [locale: string]: string | {\n        [stringKey: string]: string\n    }\n}\n```\n\nAn object containing all the localization strings.\n\nThe key should be the locale name, and the value can either be _the path to the locale JSON file_ or _an object mapping the string key to the localized string_.\n\nUsing a JSON path has the advantage of automatically detecting changes across compilations, which is useful in development.\n\nExample:\n```js\nnew LocalizeAssetsPlugin({\n    locales: {\n        en: './locales/en.json',\n        es: './locales/es.json'\n        // ...\n    }\n    // ...\n})\n```\n\nOr:\n\n```js\nnew LocalizeAssetsPlugin({\n    locales: {\n        en: {\n            helloWorld: 'Hello World!',\n            goodbyeWorld: 'Goodbye World!'\n            // ...\n        },\n        es: {\n            helloWorld: '¡Hola Mundo!',\n            goodbyeWorld: '¡Adiós Mundo!'\n            // ...\n        }\n        // ...\n    }\n    // ...\n})\n```\n\n#### functionName\nType: `string`\n\nDefault: `__`\n\nThe function name to use to detect localization string keys.\n\n```js\nconst message = __('helloWorld') // =\u003e 'Hello world!'\n```\n#### throwOnMissing\nType: `boolean`\n\nDefault: `false`\n\nThrow an error if a string key is not found in a locale object.\n\n#### sourceMapForLocales\nType: `string[]`\n\nAn array of locales that source-maps should be emitted for. Source-maps are enabled via [`devtool`](https://webpack.js.org/configuration/devtool/).\n\n#### warnOnUnusedString\nType: `boolean`\n\nDefault: `false`\n\nEnable to see warnings when unused string keys are found.\n\n### localizeCompiler\nType:\n```ts\ntype LocalizeCompiler = {\n    // localizer function name (eg. __)\n    [functionName: string]: (\n        this: LocalizeCompilerContext,\n        localizerArguments: string[],\n        localeName: string,\n    ) =\u003e string\n}\n```\n\nDefault:\n```ts\nconst localizeCompiler = {\n    __(localizerArguments) {\n        const [key] = localizerArguments\n        const keyResolved = this.resolveKey()\n        return keyResolved ? JSON.stringify(keyResolved) : key\n    }\n}\n```\n\nAn object of functions to generate a JS string to replace the `__()` call with. The object key is the localize function name, and its function gets called for each localize function call (eg. `__(...)`) for each locale. This allows you to have multiple localization functions, with separate compilation logic for each of them.\n\nNote, you cannot use both `functionName` and `localizeCompiler`. Simply set the function name as a key in the `localizeCompiler` object instead.\n\n#### localizerArguments\nAn array of strings containing JavaScript expressions. The expressions are stringified arguments of the original call. So `localizerArguments[0]` will be a JavaScript expression containing the translation key.\n\n#### localeName\nThe name of the current locale\n\n#### `this` context\n\n| Name | Type | Description |\n| - | - | - |\n| `resolveKey` | `(key?: string) =\u003e string` | A function to get the localized data given a key. Defaults to the key passed in. |\n| `emitWarning` | `(message: string) =\u003e void` | Call this function to emit a warning into the Webpack build. |\n| `emitError` | `(message: string) =\u003e void` | Call this function to emit an error into the Webpack build.  |\n| `callNode` | [`CallExpression`](https://github.com/estree/estree/blob/master/es5.md#callexpression) | [AST](https://github.com/estree/estree) node representing the original call to the localization function (eg. `__()`). |\n\n`localizeCompiler` must return a string containing a JavaScript expression. The expression will be injected into the bundle in the place of the original `__()` call. The expression should represent the localized string.\n\nYou can use `localizeCompiler` to do inject more localization logic (eg. pluralization).\n\n\n\u003cbr\u003e\n\n\u003cp align=\"center\"\u003e\n\t\u003ca href=\"https://privatenumber-sponsors.vercel.app/api/sponsor?tier=gold\"\u003e\n\t\t\u003cpicture\u003e\n\t\t\t\u003csource width=\"830\" media=\"(prefers-color-scheme: dark)\" srcset=\"https://privatenumber-sponsors.vercel.app/api/sponsor?tier=gold\u0026image=dark\"\u003e\n\t\t\t\u003csource width=\"830\" media=\"(prefers-color-scheme: light)\" srcset=\"https://privatenumber-sponsors.vercel.app/api/sponsor?tier=gold\u0026image\"\u003e\n\t\t\t\u003cimg width=\"830\" src=\"https://privatenumber-sponsors.vercel.app/api/sponsor?tier=gold\u0026image\" alt=\"Premium sponsor banner\"\u003e\n\t\t\u003c/picture\u003e\n\t\u003c/a\u003e\n\u003c/p\u003e\n\n## 💁‍♀️ FAQ\n\n### How does this work and how is it so fast?\nThis plugin has two modes: _Single-locale_ and _Multi-locale_.\n\nIn _Single-locale mode_, it works just like [i18n-webpack-plugin](https://github.com/webpack-contrib/i18n-webpack-plugin). It replaces the localization calls with localized strings during Webpack's module parsing stage. Since there is only one locale, localization only needs to be done once at the earliest possible stage.\n\nIn _Multi-locale mode_, it inserts placeholders instead of the localized strings at the module parsing stage. After minification, all assets are duplicated for each locale and the placeholders are replaced with the localized strings via find-and-replace.\n\nThe speed gains come from:\n- Applying localization to minified assets. By doing so, we can avoid re-minifying the assets for each locale.\n- Using find-and-replace to localize. Find-and-replace is literally just looking for a pattern in a string and replacing it, so there is no AST parsing costs incurred for each locale.\n\n\n### How does this compare to [i18n-webpack-plugin](https://github.com/webpack-contrib/i18n-webpack-plugin)?\n\n_First of all, thank you to i18n-webpack-plugin for the original idea and implementation and serving the community._\n\n`webpack-localize-assets-plugin` vs `i18n-webpack-plugin`:\n- **Is actively maintained** `webpack-localize-assets-plugin` is actively maintained. `i18n-webpack-plugin` is no longer developed/maintained and has been archived with no official alternative.\n- **Has Wepback 5 support** `webpack-localize-assets-plugin` supports Webpack 4 and 5. `i18n-webpack-plugin` only supports up to Webpack 4\n- **Is optimized for multiple locales** `webpack-localize-assets-plugin` is designed to support multiple locales efficiently (and it's blazing fast!). `i18n-webpack-plugin` only supports one locale so building with multiple locales requires complete re-builds for each one.\n\n### How does this approach compare to run-time localization?\nThere are two approaches to localization:\n  - **Build-time localization** Happens during building/compiling. Localized strings are baked into the assets basically by find-and-replace. _This plugin is an example of build-time localization._\n  - **Run-time localization** Happens when the application is running. An asset with localized strings is loaded and strings are referenced by unique key.\n\nHere is a comparison:\n\n\u003ctable\u003e\n  \u003cthead\u003e\n    \u003ctr\u003e\n      \u003cth\u003e\u003c/th\u003e\n      \u003cth\u003eRun-time\u003c/th\u003e\n      \u003cth\u003eBuild-time\u003c/th\u003e\n    \u003c/tr\u003e\n  \u003c/thead\u003e\n  \u003ctbody\u003e\n    \u003ctr valign=\"top\"\u003e\n      \u003cth\u003eOutput size\u003c/th\u003e\n      \u003ctd\u003e\n        \u003cstrong\u003eSmall.\u003c/strong\u003e\n        \u003cbr\u003e\n        Application code is agnostic to locale so it only needs to be produced once. Locale data files are produced for each locale to be loaded by application at run-time.\n      \u003c/td\u003e\n      \u003ctd\u003e\n        \u003cstrong\u003eLarge.\u003c/strong\u003e\n        \u003cbr\u003e\n        The entire build is multiplied for every locale. The impact of this multiplication increases with assets that don't require localization (eg. source maps, vendor chunks).\n        \u003cbr\u003e\u003cbr\u003e\n        Comparing the size of one locale between build-time and run-time, build-time has a slight advantage because there is no \"loading overhead\" (requesting locale data, long reference keys, etc.). This difference is small but can be negligible after \u003ca href=\"https://github.com/privatenumber/webpack-json-access-optimizer\"\u003egood minification\u003c/a\u003e \u0026 compression.\n      \u003c/td\u003e\n    \u003c/tr\u003e\n    \u003ctr valign=\"top\"\u003e\n      \u003cth\u003eBuild time\u003c/th\u003e\n      \u003ctd\u003e\n        \u003cstrong\u003eFast.\u003c/strong\u003e\n        \u003cbr\u003e\n        It's a lot faster because the build only needs to be produced once. Each locale data needs to be produced but there's no processing cost.\n      \u003c/td\u003e\n      \u003ctd\u003e\n        \u003cstrong\u003eSlow.\u003c/strong\u003e\n        \u003cbr\u003e\n        Build speed gets slower with size; so with the build being multiplied for each locale, it's very slow. Although optimizations (like this plugin) can apply localization post-bundling to re-use bundles across multiple locales, it's still a lot slower because large assets take time to localize and write to disk.\n        This gets much slower when enabling things like source maps. To improve speed, you might enable source maps only for the main locale at the cost of debugging experience in other locales.\n      \u003c/td\u003e\n    \u003c/tr\u003e\n    \u003ctr valign=\"top\"\u003e\n      \u003cth\u003eLoading time\u003c/th\u003e\n      \u003ctd\u003e\n        \u003cstrong\u003eFast.\u003c/strong\u003e\n        \u003cbr\u003e\n        Although initial page-load might need to request at least two assets instead of one (localization data and application), this can still be very fast with minification \u0026 compression. Even faster when using \u003ca href=\"https://stackoverflow.com/a/59310436/911407\"\u003eHTTP/2 multiplexing\u003c/a\u003e and \u003ca href=\"https://developer.mozilla.org/en-US/docs/Web/HTML/Link_types/preload\"\u003epreloading\u003c/a\u003e/\u003ca href=\"https://javascript.info/script-async-defer\"\u003easync\u003c/a\u003e.\n        \u003cbr\u003e\u003cbr\u003e\n        There's also a notable benefit of fast locale switching. When a user changes their locale, only the new locale asset needs to be loaded because the application code (the larger asset) is already loaded or will have a cache-hit.\n      \u003c/td\u003e\n      \u003ctd\u003e\n        \u003cstrong\u003eFast.\u003c/strong\u003e\n        \u003cbr\u003e\n        Since localization is baked-in, there is no need to load an additional asset of just locale strings.\n        \u003cbr\u003e\u003cbr\u003e\n        However, there is a large cost to when users switch locales as the entire app will need to be re-loaded and there will be no cache-hits if it's a new locale.\n      \u003c/td\u003e\n    \u003c/tr\u003e\n  \u003c/tbody\u003e\n\u003c/table\u003e\n\n\n## Sponsors\n\n\u003cp align=\"center\"\u003e\n\t\u003ca href=\"https://privatenumber-sponsors.vercel.app/api/sponsor?tier=silver1\"\u003e\n\t\t\u003cpicture\u003e\n\t\t\t\u003csource width=\"410\" media=\"(prefers-color-scheme: dark)\" srcset=\"https://privatenumber-sponsors.vercel.app/api/sponsor?tier=silver1\u0026image=dark\"\u003e\n\t\t\t\u003csource width=\"410\" media=\"(prefers-color-scheme: light)\" srcset=\"https://privatenumber-sponsors.vercel.app/api/sponsor?tier=silver1\u0026image\"\u003e\n\t\t\t\u003cimg width=\"410\" src=\"https://privatenumber-sponsors.vercel.app/api/sponsor?tier=silver1\u0026image\" alt=\"Premium sponsor banner\"\u003e\n\t\t\u003c/picture\u003e\n\t\u003c/a\u003e\n\t\u003ca href=\"https://privatenumber-sponsors.vercel.app/api/sponsor?tier=silver2\"\u003e\n\t\t\u003cpicture\u003e\n\t\t\t\u003csource width=\"410\" media=\"(prefers-color-scheme: dark)\" srcset=\"https://privatenumber-sponsors.vercel.app/api/sponsor?tier=silver2\u0026image=dark\"\u003e\n\t\t\t\u003csource width=\"410\" media=\"(prefers-color-scheme: light)\" srcset=\"https://privatenumber-sponsors.vercel.app/api/sponsor?tier=silver2\u0026image\"\u003e\n\t\t\t\u003cimg width=\"410\" src=\"https://privatenumber-sponsors.vercel.app/api/sponsor?tier=silver2\u0026image\" alt=\"Premium sponsor banner\"\u003e\n\t\t\u003c/picture\u003e\n\t\u003c/a\u003e\n\u003c/p\u003e\n\n\u003cp align=\"center\"\u003e\n\t\u003ca href=\"https://github.com/sponsors/privatenumber\"\u003e\n\t\t\u003cimg src=\"https://cdn.jsdelivr.net/gh/privatenumber/sponsors/sponsorkit/sponsors.svg\"\u003e\n\t\u003c/a\u003e\n\u003c/p\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fprivatenumber%2Fwebpack-localize-assets-plugin","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fprivatenumber%2Fwebpack-localize-assets-plugin","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fprivatenumber%2Fwebpack-localize-assets-plugin/lists"}