json2po-stream

1.0.3 • Public • Published

json2po-stream

Create .po files.

Pipe ndjson in and get a .po formatted file out.

The ndjson objects should be entries and look something like this:

{
  "id": "Untranslated string",
  "str": "Translated string"
}

Output:

msgid "Untranslated string"
msgstr "Translated string"

Ok so thats fun...but what about

Multi line strings

{
  "id": "",
  "str": [
    "Language: en\\n",
    "Content-Type: text/plain; charset=UTF-8\\n"
  ]
}

Output:

msgid ""
msgstr ""
"Language: en\n"
"Content-Type: text/plain; charset=UTF-8\n"

Plurals

{
  "id": "found %d fatal error",
  "idPlural": "found %d fatal errors",
  "str": [
    "s'ha trobat %d error fatal",
    "s'han trobat %d errors fatals"
  ]
}

Output:

msgid "found %d fatal error"
msgid_plural "found %d fatal errors"
msgstr[0] "s'ha trobat %d error fatal"
msgstr[1] "s'han trobat %d errors fatals"

Context

{
  "context": "Languages",
  "id": "2co_enable_fraud_verification",
  "str": "Enable support of fraud notification"
}
msgctxt "Languages"
msgid "2co_enable_fraud_verification"
msgstr "Enable support of fraud notification"

Comments

{
  "translatorComments": [
    "Base pack of \"English\" language variables",
    "Compiled by computer"
  ],
  "extractedComments": "Enable support of fraud notification",
  "reference": "src/msgcmp.c:338 src/po-lex.c:699",
  "flag": "c-format",
  "id": "found %d fatal error",
  "str": "Status for orders with failed fraud review"
}
# Base pack of "English" language variables
# Compiled by computer
#. Enable support of fraud notification
#: src/msgcmp.c:338 src/po-lex.c:699
#, c-format
msgid "found %d fatal error"
msgstr "Status for orders with failed fraud review"

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Tag
  • 1.0.3
    26
    • latest

Version History

  • Version
    Downloads (Last 7 Days)
    • Published
  • 1.0.3
    26
  • 1.0.2
    0
  • 1.0.1
    0

Package Sidebar

Install

npm i json2po-stream

Weekly Downloads

26

Version

1.0.3

License

ISC

Last publish

Collaborators

  • alanshaw