mirror of
https://github.com/Ocelot-Social-Community/Ocelot-Social.git
synced 2025-12-12 23:35:58 +00:00
Replace argfile by slurpfile (#8309)
This commit is contained in:
parent
01845928b2
commit
4f02060fd7
@ -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([])
|
||||
|
||||
@ -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
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user