i18next / i18next-gettext-converter

converts gettext .mo or .po to 18next json format and vice versa
MIT License
196 stars 56 forks source link

Node 16 not supported #149

Closed jashment closed 2 years ago

jashment commented 2 years ago

šŸ› Bug Report

This package does not work with Node version 16.

To Reproduce

  1. Set node environment to v16
  2. Create a simple po file:
    
    msgid ""
    msgstr ""
    "Project-Id-Version: i18next-conv\n"
    "mime-version: 1.0\n"
    "Content-Type: text/plain; charset=utf-8\n"
    "Content-Transfer-Encoding: 8bit\n"
    "Plural-Forms: nplurals=2; plural=(n > 1)\n"
    "POT-Creation-Date: 2022-02-04T22:13:20.856Z\n"
    "PO-Revision-Date: 2022-02-04T22:13:20.856Z\n"
    "Language: en\n"

msgid "This is a string" msgstr "This is a string"

3. Use i18next-conv with the following command:
```js
i18next-conv -l en -s en.po -t out.json
  1. The conversion will say "file written" in green. If you try to find out.json, it will not exist.

Expected behavior

Expect the conversion to work and out.json with the translated strings.

Your Environment

Additional Details

With a little digging, found that in Node 16 it is due to this particular line:

i18next-conv/bin/index.js:157:9 
{
  code: ā€˜ERR_INVALID_CALLBACKā€™
}

mkdir requires a callback, which is not supplied.

In the package.json it states that supported node versions are node >= 12.2.

Alternative could be to state in the package.json that only node version 12.2 is supported.

perrin4869 commented 2 years ago

Oh so sorry, somehow that escaped me! That's a mistake, it should be mkdirSync instead. I will fix this, thanks for the report!

perrin4869 commented 2 years ago

Released in v12.0.1