Security News
pnpm 10.0.0 Blocks Lifecycle Scripts by Default
pnpm 10 blocks lifecycle scripts by default to improve security, addressing supply chain attack risks but sparking debate over compatibility and workflow changes.
jquery-i18n-loader
Advanced tools
A loader for Webpack that injects locale files for use with wikimedia/jquery.i18n.
There didn't seem to be any loaders that supported the jQuery.i18n internationalization library, so I decided I would create one myself. I plan to soon fork wikimedia/jquery.i18n in the near future and implement support for module systems such as Webpack.
Below is a simple Webpack configuration file (webpack.config.js).
var Path = require("path");
module.exports = {
entry: "./app/main.js",
output: {
filename: "bundle.js"
},
module: {
loaders: [{
test: /\.locale.json$/,
loader: "jquery-i18n"
}]
}
};
Next we need to create a locale file (en.locale.json).
{
"@metadata" : {
"authors" : [
"Lewis"
],
"last-updated": "2015-08-03",
"locale": "en"
},
"hello-world": "Hello World!",
"greetings": "Greetings $1!"
}
Lastly, we'll require jQuery.i18n and the locale file.
// require jQuery and attach it to the window (eww).
window.$ = window.jQuery = require("jquery");
// Since there is a number of files, we'll make use of require.context to make it more readable.
var req = require.context("jquery.i18n/src");
// Quick and dirty way to require all the necessary files. We do it this way to maintain require order.
var files = ["js", "messagestore", "fallbacks", "parser", "emitter", "language"];
files.forEach(function(module) {
req("./jquery.i18n." + module);
});
// Require the locale file.
require("./en.locale.json");
// Alert the user to show it's working.
alert('$.i18n("hello-world") -> ' + $.i18n("hello-world"));
alert('$.i18n("greetings", "Lewis") -> ' + $.i18n("greetings", "Lewis"));
FAQs
jQuery based i18n loader for Webpack.
We found that jquery-i18n-loader demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer 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
pnpm 10 blocks lifecycle scripts by default to improve security, addressing supply chain attack risks but sparking debate over compatibility and workflow changes.
Product
Socket now supports uv.lock files to ensure consistent, secure dependency resolution for Python projects and enhance supply chain security.
Research
Security News
Socket researchers have discovered multiple malicious npm packages targeting Solana private keys, abusing Gmail to exfiltrate the data and drain Solana wallets.