
Product
Reachability for Ruby Now in Beta
Reachability analysis for Ruby is now in beta, helping teams identify which vulnerabilities are truly exploitable in their applications.
@pitcher/machine-gettext
Advanced tools
machine-gettext is a node module for adding machine translations to GNU gettext .po files.
To translate content, it uses Google translate cloud service.
this is a fork of https://github.com/signavio/machine-gettext
Install machine-gettext by running npm install -g machine-gettext.
You can use machine-gettext via the command line or require it in a JavaScript file.
On the command line you can run machine-gettext with the following arguments:
-in, --input: Relative path to input file
-out, --output: Relative path to output file
-f, --fuzzy: If specified, mark added translation as fuzzy
-o, --overwrite: If specified, overwrite existing fuzzy translations
The following example writes all missing translations as non-fuzzy msgstrs into messages and overwrites fuzzy messages:
machine-gettext -i=messages.po -o=messages.po -m=non-fuzzy-overwrite
You can also require the module as translateGettext in a JavaScript file and execute translateGettext as a function with the following arguments:
input (string): Relative path to input file
markAsFuzzy (boolean): If true, mark added translation as fuzzy
overwrite (boolean): If true, overwrite existing fuzzy translations
callback (function): Executed after all messages have been processed. Takes a gettext-parser.po file object as its argument.
output (string, optional): Relative path to output file
The following example loads the content of ./messages.po, adds missing translations and logs the new content:
const translateGettext = require('translateGettext')
poFile = parser.po.parse(fileSystem.readFileSync('./messages.po'))
translateGettext(poFile, true, false, processedPoFile => {
console.log(processedPoFile)
})
Note: The example code marks the new translations as fuzzy and doesn't overwrite existing fuzzy translations.
Contributions are welcome.
Make sure you run the tests with npm run test before creating a pull request and add test cases that cover the contributed code.
Possible improvement are, for example:
explicitely set the target language (currently determined via the .po file header),
allow integration with alternative translation services,
better support for interpolation and pluralization,
support list of terms that shouldn't be translated (for example: product names),
translation memory support.
FAQs
Add machine translations to gettext .po files
The npm package @pitcher/machine-gettext receives a total of 1 weekly downloads. As such, @pitcher/machine-gettext popularity was classified as not popular.
We found that @pitcher/machine-gettext demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 3 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.

Product
Reachability analysis for Ruby is now in beta, helping teams identify which vulnerabilities are truly exploitable in their applications.

Research
/Security News
Malicious npm packages use Adspect cloaking and fake CAPTCHAs to fingerprint visitors and redirect victims to crypto-themed scam sites.

Security News
Recent coverage mislabels the latest TEA protocol spam as a worm. Here’s what’s actually happening.