Research
Security News
Quasar RAT Disguised as an npm Package for Detecting Vulnerabilities in Ethereum Smart Contracts
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
l10n-translator
Advanced tools
A simple module for loading l10n catalogs and retrieving verbiage from them. Work in progress, fits my current usage case better than some of the other modules available. Likely not production ready until I implement the ability to specify a path.
If you're a Node user, Translator is available on npm:
$ npm install l10n-translator
If you're interested, you can also:
npm test
or
make test
To verify things are still wired up correctly.
Using Translator is relatively simple, currently only set up for usage as a require
module. Out of the box looks like this:
var Translator = require('l10n-translator'),
catalog = new Translator('relative/project/path');
term = catalog.lookup('PROPERTY_NAME');
// -> { code: 'PROPERTY_NAME', locale: 'en_us', value: null }
You can specify the default/fallback locale by:
var catalog = new Translator('relative/project/path','en_fr');
or by changing it:
catalog.setLocale('en_fr');
or at will:
catalog.lookup('PROPERTY_NAME', req.user.locale)
Catalog locale files should be placed in the folder you provide when creating a new Translator. They should end in .js
, be named simple things like en_us
or en_fr
, and be formatted something like this:
// l10n `en_us`
var defs = module.exports = {};
// constants style
defs.SIGNIN_FAILED = "You couldn't sign in. Error Code: #104";
defs.SUBMIT_BUTTON = "Submit";
defs.SIGN_OUT_ACTION = "Log out";
Loads all *.js
files in a relative directory
and attaches them to the translator.catalog
. In the future locales
will be able to be specified. The default locale
is currently en_us
.
If you attempt to lookup a value from a catalog (en_fr
) that does not exist or is not loaded, Translator will try to return the value from the default catalog.
var term = catalog.lookup('known_value', 'loaded_catalog');
// -> { code: 'known_value', locale: 'loaded_catalog', value: VALUE }
var term = catalog.lookup('known_value', 'null_catalog');
// -> { code: 'known_value', locale: 'default_catalog', value: VALUE }
This allows you to decide to ignore the result and pass it through, or strictly enforce only showing it if the locale matches your desired input locale. Value is returned as null when no results were able to be found.
1.0.1
Makefile
for tests1.0.0
process.cwd()
) to be provided)
-- Is actually required more than "allowed"languages
to be specified (expect functionality in future release)0.0.2
FAQs
Simple module for storing and retrieving l10n catalogs
The npm package l10n-translator receives a total of 0 weekly downloads. As such, l10n-translator popularity was classified as not popular.
We found that l10n-translator 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
Security News
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
Security News
Research
A supply chain attack on Rspack's npm packages injected cryptomining malware, potentially impacting thousands of developers.
Research
Security News
Socket researchers discovered a malware campaign on npm delivering the Skuld infostealer via typosquatted packages, exposing sensitive data.