Skip to content

Update dependencies (gettext-parser 9, gettext-to-messageformat 0.4, commander 15, jest 30) and fix the CLI - #104

Open
hthetiot wants to merge 16 commits into
mikeedwards:masterfrom
Baladins:master
Open

Update dependencies (gettext-parser 9, gettext-to-messageformat 0.4, commander 15, jest 30) and fix the CLI#104
hthetiot wants to merge 16 commits into
mikeedwards:masterfrom
Baladins:master

Conversation

@hthetiot

@hthetiot hthetiot commented Dec 15, 2021

Copy link
Copy Markdown

The dependency tree on master is several majors behind and trips GitHub/npm security alerts. This brings it current and fixes the breakage the upgrades surfaced along the way. Output is unchanged, header names included.

Changes proposed

1.0.1 / 2026-07-23

Dependency refresh, existing output is unchanged.

  • Updated gettext-parser to 9, gettext-to-messageformat to 0.4 and commander to 15.
  • Added the escape-params option (--no-escape-params), set it to false to keep {, }, # and \ unescaped in format: 'mf' (issue [1-alpha] Over escaping braces #77).
  • Fixed the executable, which crashed on commander 15, along with its --full-mf/-M and --fallback-to-msgid flags.
  • Moved the messageformat examples to @messageformat/core, messageformat@4 is a different thing.
  • Tests moved from jest 25 to jest 30, and node >= 24.13 is now required.

Forked until merged

Until this lands, the same main is published as @baladins/po2json (https://www.npmjs.com/package/@baladins/po2json) pkg on npm while (https://github.com/Baladins/po2json/tree/master) is this PR for anyone who needs the audit fixes today, see fork notes. It is meant to stay a drop-in replacement and will be deprecated if this is merged.

@hthetiot

Copy link
Copy Markdown
Author

Note: gettext-parser@4+ break tests so I upgraded to gettext-parser@3 at least.

@hthetiot

hthetiot commented Dec 15, 2021

Copy link
Copy Markdown
Author

Screenshot 2021-12-15 at 21 17 40https://github.com/mikeedwards/po2json/blob/v0.4.2/package.json#L69

Fixed using version 1.0.0-beta-3

@hthetiot

Copy link
Copy Markdown
Author

Still using 1.0.0-beta-3, "{" character get escaped in the string, while using 0.4 it was not the case.

@hthetiot hthetiot changed the title Apply npm audit fixes and upgrade to gettext-parser@3 [deps updates] Apply npm audit fixes and upgrade to latest packages Jul 23, 2026
@hthetiot

Copy link
Copy Markdown
Author

Hello @eemeli Can you review my update that support gettext-to-messageformat@4 and gettext-parser@9 and full deps updates. I just had to fix headers case and minor fixes.

@hthetiot hthetiot changed the title [deps updates] Apply npm audit fixes and upgrade to latest packages [maintained] Apply npm audit fixes and upgrade to latest packages Jul 23, 2026
@eemeli

eemeli commented Jul 23, 2026

Copy link
Copy Markdown

I don't understand what the ask of me here is? I'd be happy to review a PR on gettext-to-messageformat, if you'd like to submit one there?

gettext-to-messageformat escapes { } # and \ so that MessageFormat reads them
as literals, which writes a {{error}} placeholder out as \{\{error\}\}. That is
what you want when the JSON is compiled by MessageFormat, but not for consumers
reading it as plain strings and using braces for their own translation
parameters, ngx-translate among them (issue mikeedwards#77).

escape-params defaults to true, so output is unchanged unless it is turned off,
through the option or --no-escape-params on the command line. The replacement
list it swaps in is g2m's own minus the escaping rule, exported as
po2json.mfReplacements to build a custom mfOptions.replacements from. Anything
passed through mfOptions still wins over both.

Also document mfOptions, which had none, and cut the 1.0.1 release notes.

Refs mikeedwards#77
@hthetiot

hthetiot commented Jul 23, 2026

Copy link
Copy Markdown
Author

I don't understand what the ask of me here is?

I would d'like you if possible, to review this PR that use updated gettext-to-messageformat@^0.4.0 and @messageformat/core@3.4.0

Generally I thought you may be interested in this PR to land to keep the po2json using up-to-date package that you maintain and would be a good reviewer for that. Sorry if was not the right call.

@hthetiot

Copy link
Copy Markdown
Author

See fork notes: https://github.com/Baladins/po2json#fork-notes
Maintained mackage available under @baladins/po2json for now.

@hthetiot hthetiot changed the title [maintained] Apply npm audit fixes and upgrade to latest packages [maintained fork] Apply npm audit fixes and upgrade to latest packages and other contributor PRs Jul 23, 2026
@hthetiot hthetiot changed the title [maintained fork] Apply npm audit fixes and upgrade to latest packages and other contributor PRs Update dependencies (gettext-parser 9, gettext-to-messageformat 0.4, commander 15, jest 30) and fix the CLI Jul 23, 2026
@hthetiot

Copy link
Copy Markdown
Author

updated description to be more clear

The dependency tree on `master` is several majors behind and trips GitHub/npm security alerts. This brings it current and fixes the breakage the upgrades surfaced along the way. Output is unchanged, header names included.

## Changes proposed

### 1.0.1 / 2026-07-23
Dependency refresh, existing output is unchanged.

 * Updated gettext-parser to 9, gettext-to-messageformat to 0.4 and commander to 15.
 * Added the `escape-params` option (`--no-escape-params`), set it to `false` to keep `{`, `}`, `#` and `\` unescaped in `format: 'mf'` (issue #77).
 * Fixed the executable, which crashed on commander 15, along with its `--full-mf`/`-M` and `--fallback-to-msgid` flags.
 * Moved the messageformat examples to `@messageformat/core`, `messageformat@4` is a different thing.
 * Tests moved from jest 25 to jest 30, and node >= 24.13 is now required.


## Forked until merged

Until this lands, the same tree is published as [`@baladins/po2json`](https://www.npmjs.com/package/@baladins/po2json) for anyone who needs the audit fixes today, see [fork notes](https://github.com/Baladins/po2json#fork-notes). It is meant to stay a drop-in replacement and will be deprecated if this is merged.

@eemeli

eemeli commented Jul 23, 2026

Copy link
Copy Markdown

I don't understand what the ask of me here is?

I would d'like you if possible, to review this PR that use updated gettext-to-messageformat@^0.4.0 and @messageformat/core@3.4.0

Generally I thought you may be interested in this PR to land to keep the po2json using up-to-date package that you maintain and would be a good reviewer for that. Sorry if was not the right call.

Sorry, I don't really have the bandwidth for that. I've not worked on the code around this for a while, and the stuff near this that I'm maintaining for work is in Python: https://github.com/mozilla/moz-l10n/tree/main/python/moz/l10n/formats/gettext

@hthetiot

hthetiot commented Jul 24, 2026

Copy link
Copy Markdown
Author

Thank you @eemeli i completely understand. Thank you for taking the time replying.
New maintainer are here for that. Thx for maintaining gettext alive elsewhere ;)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants