
Research
Two Malicious Rust Crates Impersonate Popular Logger to Steal Wallet Keys
Socket uncovers malicious Rust crates impersonating fast_log to steal Solana and Ethereum wallet keys from source code.
@noreajs/i18n
Advanced tools
Library of tools necessary for the internationalization of an application, based on polyglot from airbnb
Library of tools necessary for the internationalization of an application, based on polyglot from airbnb.
npm install @noreajs/i18n --save
The package already contains it's types definitions files for typescript developers.
Translations files
The default translation file is i18n
. If the folder doesn't exit, it will be created automatically by the package.
Synchronous initialize i18n
import I18n from "../i18n/I18n";
const i18n = new I18n({
locales: ["en-US", "en-FR"],
fallback: "en-fr",
languagesFolder: "i18n" // i18n is the default value and it is optional.
});
// set the locale
i18n.setLocale("en-US");
i18n.t("users.index.empty");
Asynchronous initialization
import I18n from "../i18n/I18n";
const i18n = new I18n({
locales: ["en-US", "en-FR"],
fallback: "en-fr",
syncLoading: false
});
// load translations (asynchronous method)
i18n.loadTranslations((data) => {
i18n.setLocale("en-fr");
console.log("t:", i18n.t("users.index.empty"));
});
To initialize a the i18n package, you need to fill some parameters.
Property | Type | Default | Note |
---|---|---|---|
locales | Array | Locale supported | |
fallback | string | first locales value | Fallback locale |
languagesFolder | string | i18n | Folder where translations files are stored. This folder is automatically created when not exists |
lazyLoading | boolean | false | Resolve translation key while translate |
caseSensitive | boolean | false | users.index.empty and users.index.EMPTY will be treated the same way |
syncLoading | boolean | true | Load translations during initialization |
polyglotOptions | polyglot options | Only interpolation, allowMissing and onMissingKey is allowed |
Method | Description |
---|---|
setLocale | Change the current locale |
getLocale | Get the current locale |
getTranslations | Get the available translations loaded from files |
loadTransactions | Asynchronous method to load translations when syncLoading is false |
t | Translate a given key |
FAQs
Library of tools necessary for the internationalization of an application, based on polyglot from airbnb
We found that @noreajs/i18n 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.
Research
Socket uncovers malicious Rust crates impersonating fast_log to steal Solana and Ethereum wallet keys from source code.
Research
A malicious package uses a QR code as steganography in an innovative technique.
Research
/Security News
Socket identified 80 fake candidates targeting engineering roles, including suspected North Korean operators, exposing the new reality of hiring as a security function.