mirror of
https://github.com/IT4Change/Ocelot-Social.git
synced 2025-12-12 23:35:52 +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,
|
# by the corresponding values of target. If a key does not exist in target,
|
||||||
# the value is set to null.
|
# 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)
|
# source should be primary or fallback locale file (here en.json)
|
||||||
# taget is the locale file to normalize (here es.json)
|
# taget is the locale file to normalize (here es.json)
|
||||||
@ -22,10 +22,10 @@ def keys_to_paths_recursive($path):
|
|||||||
then with_entries(
|
then with_entries(
|
||||||
($path + [.key]) as $path |
|
($path + [.key]) as $path |
|
||||||
if (.value | type == "string")
|
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)
|
else .value |= keys_to_paths_recursive($path)
|
||||||
end)
|
end)
|
||||||
else .
|
else .
|
||||||
end;
|
end;
|
||||||
|
|
||||||
$source | keys_to_paths_recursive([])
|
$source[0] | keys_to_paths_recursive([])
|
||||||
|
|||||||
@ -9,8 +9,8 @@ for locale_file in "${locale_list[@]}"
|
|||||||
do
|
do
|
||||||
jq -n \
|
jq -n \
|
||||||
-f $(dirname "$0")/normalize-locales.jq \
|
-f $(dirname "$0")/normalize-locales.jq \
|
||||||
--argfile source $ROOT_DIR/webapp/locales/en.json \
|
--slurpfile source $ROOT_DIR/webapp/locales/en.json \
|
||||||
--argfile target $ROOT_DIR/webapp/locales/$locale_file \
|
--slurpfile target $ROOT_DIR/webapp/locales/$locale_file \
|
||||||
> "$tmp"
|
> "$tmp"
|
||||||
mv "$tmp" $ROOT_DIR/webapp/locales/$locale_file
|
mv "$tmp" $ROOT_DIR/webapp/locales/$locale_file
|
||||||
done
|
done
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user