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

pofile

Package Overview
Dependencies
Maintainers
1
Versions
30
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

pofile

Parse and serialize Gettext PO files.

  • 1.1.4
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
523K
increased by28.12%
Maintainers
1
Weekly downloads
 
Created

What is pofile?

The 'pofile' npm package is used for parsing and manipulating gettext PO (Portable Object) files, which are commonly used for localization in software projects. It allows developers to read, write, and modify PO files programmatically.

What are pofile's main functionalities?

Parsing PO Files

This feature allows you to load and parse a PO file. The parsed content is available as an object, which you can then manipulate or inspect.

const PO = require('pofile');
PO.load('path/to/file.po', function (err, po) {
  if (err) throw err;
  console.log(po.items);
});

Modifying PO File Entries

This feature allows you to modify the entries in a PO file. For example, you can change the translation of a specific entry.

const PO = require('pofile');
PO.load('path/to/file.po', function (err, po) {
  if (err) throw err;
  po.items[0].msgstr = ['New translation'];
  console.log(po.items[0]);
});

Creating New PO Files

This feature allows you to create a new PO file from scratch. You can add new entries and save the file to the filesystem.

const PO = require('pofile');
const po = new PO();
po.items.push(new PO.Item({
  msgid: 'Hello',
  msgstr: ['Hola']
}));
po.save('path/to/newfile.po', function (err) {
  if (err) throw err;
  console.log('PO file saved!');
});

Other packages similar to pofile

Keywords

FAQs

Package last updated on 14 Dec 2022

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