From 4f02060fd7de69cfc06b93bff65ca6279f52bfe6 Mon Sep 17 00:00:00 2001 From: Max Date: Wed, 2 Apr 2025 23:09:53 +0200 Subject: [PATCH] Replace argfile by slurpfile (#8309) --- scripts/translations/normalize-locales.jq | 6 +++--- scripts/translations/normalize.sh | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/scripts/translations/normalize-locales.jq b/scripts/translations/normalize-locales.jq index 2381f9611..e3b2e68d6 100644 --- a/scripts/translations/normalize-locales.jq +++ b/scripts/translations/normalize-locales.jq @@ -4,7 +4,7 @@ # by the corresponding values of target. If a key does not exist in target, # the value is set to null. # -# jq -n --argfile source en.json --argfile target es.json -f normalize-locales.jq +# jq -n --slurpfile source en.json --slurpfile target es.json -f normalize-locales.jq # # source should be primary or fallback locale file (here en.json) # taget is the locale file to normalize (here es.json) @@ -22,10 +22,10 @@ def keys_to_paths_recursive($path): then with_entries( ($path + [.key]) as $path | if (.value | type == "string") - then .value |= ($target | find_key_by_path($path)) + then .value |= ($target[0] | find_key_by_path($path)) else .value |= keys_to_paths_recursive($path) end) else . end; -$source | keys_to_paths_recursive([]) +$source[0] | keys_to_paths_recursive([]) diff --git a/scripts/translations/normalize.sh b/scripts/translations/normalize.sh index 2f5933977..b98642d21 100755 --- a/scripts/translations/normalize.sh +++ b/scripts/translations/normalize.sh @@ -9,8 +9,8 @@ for locale_file in "${locale_list[@]}" do jq -n \ -f $(dirname "$0")/normalize-locales.jq \ - --argfile source $ROOT_DIR/webapp/locales/en.json \ - --argfile target $ROOT_DIR/webapp/locales/$locale_file \ + --slurpfile source $ROOT_DIR/webapp/locales/en.json \ + --slurpfile target $ROOT_DIR/webapp/locales/$locale_file \ > "$tmp" mv "$tmp" $ROOT_DIR/webapp/locales/$locale_file done