gettext.js icon indicating copy to clipboard operation
gettext.js copied to clipboard

Updating README to suggest the po2json-gettextjs wrapper

Open Jameson13B opened this issue 4 years ago • 2 comments

The README currently suggests using bin/po2json.js to convert .po files to .json files. This creates a json where all values are arrays with null as the first item in the array. This occurred even for singular items like so:

{
  "Most Popular": [null, "Les plus populaires"],
  "Add Manual Account": [null, "Ajouter un compte manuel"],
  "We can't find what you're searching for. Give these tips a try:": [
    null,
    "Nous ne pouvons pas trouver ce que vous cherchez. Essayez ces conseils:"
  ],
  "": {
    "project-id-version": "PACKAGE VERSION",
    "report-msgid-bugs-to": "",
    "pot-creation-date": "2020-05-18 19:37-0600",
    "po-revision-date": "YEAR-MO-DA HO:MI+ZONE",
    "last-translator": "FULL NAME <EMAIL@ADDRESS>",
    "language-team": "French <[email protected]>",
    "language": "fr-ca",
    "mime-version": "1.0",
    "content-type": "text/plain; charset=UTF-8",
    "content-transfer-encoding": "8bit",
    "plural-forms": "nplurals=2; plural=(n!=1);"
  }
}

It seems this format does not work for gettext.js. My updates suggest using bin/po2json-gettextjs(which is already included) so the format is as follows which does work for gettext.js:

{
  "Most Popular": "Les plus populaires",
  "Add Manual Account": "Ajouter un compte manuel",
  "We can't find what you're searching for. Give these tips a try:": "Nous ne pouvons pas trouver ce que vous cherchez. Essayez ces conseils:",
  "": { "language": "fr-ca", "plural-forms": "nplurals=2; plural=(n!=1);" }
}

Jameson13B avatar May 26 '20 19:05 Jameson13B

I don't think you put the po2json-gettextjs file anywhere...

Artoria2e5 avatar Jun 11 '21 05:06 Artoria2e5

The README is referring to po2json inside the bin folder of this project (node_modules/gettext.js/bin). I think you are mistaking it for po2json (and po2json-gettextjs) inside node_modules/.bin.

Stadly avatar Nov 01 '21 19:11 Stadly