From 198fc5f0e32c45160b314bd3c5a2b673b4c924d3 Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Tue, 1 Oct 2024 10:58:35 +0200 Subject: [PATCH] Bug 38048: Remove po2json deprecation warning (node:50086) [DEP0128] DeprecationWarning: Invalid 'main' field in '/kohadevbox/node_modules/po2json/package.json' of './lib/po2json'. Please either fix that or report it to the module author (Use `node --trace-deprecation ...` to show where the warning was created) See https://github.com/mikeedwards/po2json/issues/103 The project is not really maintained, so let's remove the warning on our side as a quick workaround. Test plan: Run `koha-translate --update es-ES --dev kohadev` WNC amended patch - tidied Signed-off-by: Nick Clemens --- misc/translator/LangInstaller.pm | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/misc/translator/LangInstaller.pm b/misc/translator/LangInstaller.pm index fcf78bba98b..c5b94e826b6 100644 --- a/misc/translator/LangInstaller.pm +++ b/misc/translator/LangInstaller.pm @@ -455,9 +455,10 @@ sub install_messages { make_path($modir); system "$self->{msgfmt} -o $mofile $pofile"; - my $tmp_po = sprintf '/tmp/%s-messages.po', $self->{lang}; + my $tmp_po = sprintf '/tmp/%s-messages.po', $self->{lang}; my $po2json_cmd = sprintf '%s %s %s', $self->{po2json}, $js_pofile, $tmp_po; - `$po2json_cmd`; + $po2json_cmd .= q{ 2> >(grep -v -e 'DEP0128' -e 'trace-deprecation' - )}; # Remove deprecation warning + `/usr/bin/bash -c "$po2json_cmd"`; # We need bash instead of sh (sh: 1: Syntax error: redirection unexpected) my $json = read_file($tmp_po); my $js_locale_data = sprintf 'var json_locale_data = {"Koha":%s};', $json; -- 2.39.5