refresh-i18n.sh 490 B

1234567891011121314
  1. #!/bin/bash
  2. # "Refresh" all i18n language files by merging missing keys in lang files
  3. # from a base language file. In addition, sort all files by keys.
  4. BASE_DIR=$(dirname "$0")"/../i18n" # Exclude the trailing slash.
  5. BASE_FILE="en.json"
  6. # Iterate through all i18n files and merge them into the base file,
  7. # filling in missing keys.
  8. for fpath in "$BASE_DIR/"*.json; do
  9. echo $(basename -- $fpath)
  10. echo "$( jq -s '.[0] * .[1]' -S --indent 4 "$BASE_DIR/$BASE_FILE" $fpath )" > $fpath
  11. done