
Research
/Security News
jscrambler npm Package Compromised in Supply Chain Attack
A compromised jscrambler npm release added a malicious preinstall hook that runs hidden native binaries on Linux, macOS, and Windows.
@infomaximum/localization
Advanced tools
The Localization library provides a convenient way to handle localization in your application, supporting multiple languages and plural forms. It allows you to easily retrieve localized strings and customize them based on provided parameters.
You can install the Localization library via npm:
npm install @infomaximum/localization
import { Localization, ELanguages } from "@infomaximum/localization";
To start using the Localization library, you need to create an instance of the Localization class:
const localization = new Localization({ language: ELanguages.en });
You can specify the default language during initialization. If not provided, it will default to the language detected from the user's browser settings.
You can retrieve the current language set in the Localization instance:
const currentLanguage = localization.getLanguage();
console.log("Current Language:", currentLanguage); // Output: "en" (for English)
To retrieve a localized string, use the getLocalized method:
const localizedString = localization.getLocalized({
en: "Hello, World!",
ru: "Привет, мир!",
});
console.log(localizedString); // Output: "Hello, World!"
You can also pass additional parameters to customize the localized string:
const localizedString = localization.getLocalized(
{
en: (name) => `Hello, ${name}!`,
ru: (name) => `Привет, ${name}!`,
},
{ templateData: "John" }
);
console.log(localizedString); // Output: "Hello, John!"
The library supports plural forms for different languages. You can provide singular and plural forms for each language:
const localizedString = localization.getLocalized(
{
en: { s: "1 item", p1: "%s items" },
ru: { s: "1 предмет", p1: "%s предмета", p2: "%s предметов" },
},
{ count: 5 }
);
console.log(localizedString); // Output: "5 items" (in English)
You can specify whether the localized string should be capitalized:
const localizedString = localization.getLocalized(
{
en: "hello, world!",
ru: "привет, мир!",
},
{ capitalized: true }
);
console.log(localizedString); // Output: "Hello, World!"
By default, the library detects the user's browser language to set the initial language. You can also explicitly set the language during initialization.
The library supports the following languages:
This library is released under the Apache License 2.0. See the LICENSE file for details.
FAQs
Localization for js applications
We found that @infomaximum/localization demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 2 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.

Research
/Security News
A compromised jscrambler npm release added a malicious preinstall hook that runs hidden native binaries on Linux, macOS, and Windows.

Research
/Security News
A malicious .NET package is typosquatting the Braintree SDK to steal live payment card data, merchant API keys, and host secrets from production apps.

Security News
/Research
Compromised Injective SDK npm version 1.20.21 exfiltrates wallet private keys and mnemonics through fake telemetry functionality.