...
Code Block | ||||
---|---|---|---|---|
| ||||
#!/bin/sh # Before running this script change into the ./translations directory where the web server (nginx, ...) # ships the /translations/*.json files from, for example # cd /usr/folio/folio-testing-platform/output/translations set -e BUNDLE=$(curl -s https://folio-testing.dev.folio.org/ | sed -n -E '/.*"\/(bundle\.[0-9a-z]+\.js)".*/{s//\1/p;q}') echo $BUNDLE N=$(curl -s https://folio-testing.dev.folio.org/$BUNDLE | sed -n -E '/.*"\/translations\/en-([0-9]+)\.json".*/{s//\1/p;q}') for file in ./*-*.json ; do if [ ! -e "$file" ] ; then continue fi LANG=$(echo "$file" | sed -n -E '/^.\/([^-]+)-[0-9]+\.json$/{s//\1/p;q}') if [ -z $LANG ] ; then continue fi echo "https://folio-testing.dev.folio.org/translations/$LANG-$N.json" curl -s https://folio-testing.dev.folio.org/translations/$LANG-$N.json > $LANG.json jq -s '.[0] * .[1]' $file $LANG.json > $LANG.json.new mv $LANG.json.new $file rm $LANG.json done |
To remove new translation keys replace'.[0] * .[1]'
by'.[0] as $old | .[0] * .[1] | with_entries( select( .key as $key | $old | has( $key ) ) )'
but this may remove a key that the old code uses and was forgotten to get added to the old language file.
Clean backport using yarn build
...