
Product
Introducing Socket Firewall Enterprise: Flexible, Configurable Protection for Modern Package Ecosystems
Socket Firewall Enterprise is now available with flexible deployment, configurable policies, and expanded language support.
This is a simple translation solution, which is inspired by the Symfony Translator Component.
It's a CommonJS module, so it must be used alongside with Browserify, or something similar, like WebPacker.
// Requiring the module
var translator = require('z-trans');
// Adding the translation data. This could come from anywhere like: Ajax, jsonp,
// another module or the parsed JSON contents of a DOM element.
translator.addData('en', {
domain_name: {
translation_key: '(en) translation_value: "%parameter%"',
translation_key2: 'something still not translated to the "hu" locale',
}
});
translator.addData('hu', {
domain_name: {
translation_key: '(hu) translation_value: "%parameter%"'
}
});
// Domains could be added later on if needed.
translator.addDomainData(
'en',
'another_domain_name',
{
some_key: 'some value'
}
);
// If a translation fails in the current locale, it will fall back to the
// default locale
translator.defaultLocale = 'en';
translator.locale = 'en';
// Returns '(en) translation_value: "param"'
console.log(translator.trans('translation_key', {'%parameter%': 'param'}, 'domain_name'));
// Returns 'some value'
console.log(translator.trans('some_key', null, 'another_domain_name'));
// Returns 'something still not translated to the "hu" locale'
console.log(translator.trans('translation_key2', null, 'domain_name', 'hu'));
FAQs
A simple translator that works similar to the Symfony Translator Component.
The npm package z-trans receives a total of 3 weekly downloads. As such, z-trans popularity was classified as not popular.
We found that z-trans 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.

Product
Socket Firewall Enterprise is now available with flexible deployment, configurable policies, and expanded language support.

Security News
Open source dashboard CNAPulse tracks CVE Numbering Authorities’ publishing activity, highlighting trends and transparency across the CVE ecosystem.

Product
Detect malware, unsafe data flows, and license issues in GitHub Actions with Socket’s new workflow scanning support.