New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

i18n-po-json

Package Overview
Dependencies
Maintainers
8
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

i18n-po-json - npm Package Compare versions

Comparing version 1.0.4 to 1.0.5

5

index.ts
import * as cli from 'cli';
import { readFile, writeFile } from 'fs';
import { convert } from './src/convert';
import { PoOptions, PoData } from './src/types';
import { PoOptions } from './src/types';
import { TranslationJson } from 'i18n-proto';

@@ -68,3 +69,3 @@ const options = cli.parse({

function makeOutput(data: PoData, output: string, prettify: boolean) {
function makeOutput(data: TranslationJson, output: string, prettify: boolean) {
if (output === '__stdout') {

@@ -71,0 +72,0 @@ console.log(JSON.stringify(data, undefined, prettify ? ' ' : undefined));

4

package.json
{
"name": "i18n-po-json",
"version": "1.0.4",
"version": "1.0.5",
"description": "i18n .po to .json file converter",

@@ -28,3 +28,3 @@ "main": "dist/index.js",

"eslint": "3.13.1",
"i18n-proto": "1.0.4",
"i18n-proto": "1.0.5",
"karma": "1.7.0",

@@ -31,0 +31,0 @@ "karma-browserify": "^5.1.1",

@@ -1,3 +0,9 @@

import { I18NEntry, SingleI18NEntry, PluralI18NEntry } from 'i18n-proto';
import { PoData, PoOptions } from './types';
import {
I18NEntry,
SingleI18NEntry,
PluralI18NEntry,
TranslationJson,
TranslationMeta
} from 'i18n-proto';
import { PoOptions } from './types';
import { panic, warning } from './panic';

@@ -16,3 +22,3 @@

export function convert(data: string, opts: PoOptions): PoData {
export function convert(data: string, opts: PoOptions): TranslationJson {
// entries should be separated with double CRLF

@@ -29,3 +35,3 @@ let entries = data.split("\n\n").filter((e) => !!e);

export function parseHeader(header: string): PoData['meta'] | undefined {
export function parseHeader(header: string): TranslationMeta | undefined {
let entries = header.split("\n");

@@ -42,3 +48,3 @@ let result: _ParseRetval;

let headers = result.msgStr.split("\n");
return headers.reduce<PoData['meta']>((acc, header) => {
return headers.reduce<TranslationMeta>((acc, header) => {
let [name, value] = splitInTwo(header, ':').map((v) => v.replace(/^\s+|\s+$/g, ''));

@@ -96,3 +102,3 @@ switch (name) {

return acc;
}, {} as PoData['meta']);
}, {} as TranslationMeta);
}

@@ -99,0 +105,0 @@

@@ -1,3 +0,1 @@

import { I18NEntry } from 'i18n-proto';
export type PoOptions = {

@@ -8,24 +6,1 @@ withOccurences: boolean,

};
export type Meta = {
projectIdVersion: string,
reportMsgidBugsTo: string, // email
potCreationDate: string,
poRevisionDate: string,
lastTranslator: {
name: string,
email: string
},
language: string,
languageTeam: string,
pluralForms: string, // (n: number) => number
mimeVersion: string,
contentType: string,
contentTransferEncoding: string,
generatedBy: string
};
export type PoData = {
meta?: Meta,
items: I18NEntry[]
};
import * as assert from 'assert';
import { PluralI18NEntry, SingleI18NEntry } from 'i18n-proto';
import { PoData, PoOptions } from '../src/types';
import { PluralI18NEntry, SingleI18NEntry, TranslationMeta } from 'i18n-proto';
import { PoOptions } from '../src/types';
import { overridePanic, overrideWarning } from '../src/panic';

@@ -221,3 +221,3 @@

let expected: PoData['meta'] = {
let expected: TranslationMeta = {
projectIdVersion: '2gis-online',

@@ -224,0 +224,0 @@ reportMsgidBugsTo: 'online4@2gis.ru',

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