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 - npm Package Compare versions

Comparing version 1.0.3 to 1.0.5

40

lib/po.js

@@ -117,3 +117,5 @@ var fs = require('fs');

var item = new PO.Item();
var parsedPluralForms = PO.parsePluralForms(po.headers['Plural-Forms']);
var nplurals = parsedPluralForms.nplurals;
var item = new PO.Item({ nplurals: nplurals });
var context = null;

@@ -132,3 +134,3 @@ var plural = 0;

po.items.push(item);
item = new PO.Item();
item = new PO.Item({ nplurals: nplurals });
}

@@ -239,3 +241,22 @@ }

PO.Item = function () {
PO.parsePluralForms = function (pluralFormsString) {
var results = (pluralFormsString || '')
.split(';')
.reduce(function (acc, keyValueString) {
var trimmedString = keyValueString.trim();
var equalsIndex = trimmedString.indexOf('=');
var key = trimmedString.substring(0, equalsIndex).trim();
var value = trimmedString.substring(equalsIndex + 1).trim();
acc[key] = value;
return acc;
}, {});
return {
nplurals: results.nplurals,
plural: results.plural
};
};
PO.Item = function (options) {
var nplurals = options && options.nplurals;
this.msgid = '';

@@ -250,2 +271,4 @@ this.msgctxt = null;

this.obsolete = false;
var npluralsNumber = Number(nplurals);
this.nplurals = (isNaN(npluralsNumber)) ? 2 : npluralsNumber;
};

@@ -323,2 +346,9 @@

if (text != null) {
var hasTranslation = false;
if (Array.isArray(text)) {
hasTranslation = text.some(function (text) {
return text;
});
}
if (Array.isArray(text) && text.length > 1) {

@@ -328,2 +358,6 @@ text.forEach(function (t, i) {

});
} else if (self.msgid_plural && keyword === 'msgstr' && !hasTranslation) {
for (var pluralIndex = 0; pluralIndex < self.nplurals; pluralIndex++) {
lines = lines.concat(mkObsolete + _process(keyword, '', pluralIndex));
}
} else {

@@ -330,0 +364,0 @@ var index = (self.msgid_plural && Array.isArray(text)) ?

2

package.json
{
"name": "pofile",
"description": "Parse and serialize Gettext PO files.",
"version": "1.0.3",
"version": "1.0.5",
"author": {

@@ -6,0 +6,0 @@ "name": "Ruben Vermeersch",

@@ -146,3 +146,3 @@ # pofile - gettext .po parsing for JavaScript

Copyright (C) 2013-2014 by Ruben Vermeersch <ruben@rocketeer.be>
Copyright (C) 2013-2017 by Ruben Vermeersch <ruben@rocketeer.be>
Copyright (C) 2012 by Michael Holly

@@ -149,0 +149,0 @@

Sorry, the diff of this file is not supported yet

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