Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

gettext-parser

Package Overview
Dependencies
Maintainers
2
Versions
44
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

gettext-parser

Parse and compile gettext po and mo files to/from json, nothing more, nothing less

  • 4.0.4
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
512K
increased by8.15%
Maintainers
2
Weekly downloads
 
Created

What is gettext-parser?

The gettext-parser npm package is a tool for parsing and compiling gettext files, which are commonly used for internationalization and localization of software. It supports both .po (Portable Object) and .mo (Machine Object) file formats.

What are gettext-parser's main functionalities?

Parsing .po files

This feature allows you to parse .po files into a JavaScript object. The code sample reads a .po file from the filesystem and parses it using gettext-parser.

const gettextParser = require('gettext-parser');
const fs = require('fs');

const input = fs.readFileSync('path/to/your/file.po');
const po = gettextParser.po.parse(input);
console.log(po);

Compiling .po files to .mo files

This feature allows you to compile .po files into .mo files. The code sample reads a .po file, parses it, compiles it into a .mo file, and writes the .mo file to the filesystem.

const gettextParser = require('gettext-parser');
const fs = require('fs');

const input = fs.readFileSync('path/to/your/file.po');
const po = gettextParser.po.parse(input);
const mo = gettextParser.mo.compile(po);
fs.writeFileSync('path/to/your/file.mo', mo);

Parsing .mo files

This feature allows you to parse .mo files into a JavaScript object. The code sample reads a .mo file from the filesystem and parses it using gettext-parser.

const gettextParser = require('gettext-parser');
const fs = require('fs');

const input = fs.readFileSync('path/to/your/file.mo');
const mo = gettextParser.mo.parse(input);
console.log(mo);

Compiling .mo files to .po files

This feature allows you to compile .mo files into .po files. The code sample reads a .mo file, parses it, compiles it into a .po file, and writes the .po file to the filesystem.

const gettextParser = require('gettext-parser');
const fs = require('fs');

const input = fs.readFileSync('path/to/your/file.mo');
const mo = gettextParser.mo.parse(input);
const po = gettextParser.po.compile(mo);
fs.writeFileSync('path/to/your/file.po', po);

Other packages similar to gettext-parser

Keywords

FAQs

Package last updated on 17 Jul 2020

Did you know?

Socket

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc