
Security News
MCP Steering Committee Launches Official MCP Registry in Preview
The MCP Steering Committee has launched the official MCP Registry in preview, a central hub for discovering and publishing MCP servers.
@skroutz/i18n-webpack-plugin
Advanced tools
i18n (localization) plugin for Webpack.
Forked from webpack-contrib/i18n-webpack-plugin.
npm i -D @skroutz/i18n-webpack-plugin
Or
yarn add @skroutz/i18n-webpack-plugin -D
This plugin creates bundles with translations baked in. So you can serve the translated bundle to your clients.
plugins: [
...
new I18nPlugin(localization, options)
],
localization
: object, a key-value map of localization stringsoptions.isDefaultLocale
: boolean, is this language the default oneFor functions that use %{dynamicPart}
, you can extend the String
prototype with a supplant method, like so:
String.prototype.supplant = function(o) {
return this.replace(
/%\{([^{}]*)\}/g,
(a, b) => {
const r = o[b];
return (typeof r === 'string' || typeof r === 'number') ? r : a;
}
);
};
Then, you can use the following functions in your code:
__(msgid)
Basic translation methodMarks a string as translatable:
__('Hello World!');
To translate a string with dynamic parts:
__('Hello %{username}. Welcome to %{sitename}.').supplant({
username: User.username,
sitename: App.sitename
});
n__(*msgid, n)
Pluralized translationsTo return the singular or plural form depending on how many you have:
n__('shop', 'shops', shop_count);
Additionally, to include the counter in the translated text:
n__('%{stars_count} star', '%{stars_count} stars', Shop.rating.stars).supplant({
stars_count: Shop.rating.stars
});
s__(msgid)
Scoped translationsTo provide context to the translation:
s__('Gender|Female');
s__('Formal|Are you sure?');
s__('VolumetricUnit|kg');
FAQs
Embed localization into your bundle
We found that @skroutz/i18n-webpack-plugin demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 5 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
The MCP Steering Committee has launched the official MCP Registry in preview, a central hub for discovering and publishing MCP servers.
Product
Socket’s new Pull Request Stories give security teams clear visibility into dependency risks and outcomes across scanned pull requests.
Research
/Security News
npm author Qix’s account was compromised, with malicious versions of popular packages like chalk-template, color-convert, and strip-ansi published.