
Security News
Attackers Are Hunting High-Impact Node.js Maintainers in a Coordinated Social Engineering Campaign
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.
node-translate
Advanced tools
A translation library for NodeJS that wraps node-polyglot
To build a local version for use or development:
git clone git@github.com:thestonefox/node-translate.git
cd node-translate
npm install
Installing as a node module:
npm install node-translate --save
Look at the example.js file to see a simple example of the library.
Run it with npm start
For more examples of the format of the locale files, look in ./locales/
module.exports = {
"title": "Hello, World"
}
Create a new instance of the i18n library.
var i18n = require('node-translate');
Require the relevant locale files in a associative array with the key being the name of the locale and the value being the output of the respective locale file.
i18n.requireLocales({
'en-gb': require('./locales/en-gb'),
'fr': require('./locales/fr')
});
Set the initial locale to use by providing the locale name. The first specified required locale is used as the current locale by default.
i18n.setLocale('en-gb');
Now simply call the translation method with the key to translate.
i18n.t('title');
The t method is compatible with polyglot so takes an optional second parameter for parsing variables into the translation string.
i18n.t('title', {name: "string"})
Chaining setters is also permitted.
i18n.requireLocales({'de': require('./locales/de')}).setLocale('de');
To run the Jest tests just type:
npm test
FAQs
A translation library for NodeJS that wraps node-polyglot
We found that node-translate 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
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.