From 0dea19c8db7ee14e0a9ccf3abf7e8194e2db672b Mon Sep 17 00:00:00 2001 From: Moritz Reinel <129004253+moritz-reinel@users.noreply.github.com> Date: Mon, 21 Oct 2024 19:43:33 +0200 Subject: [PATCH] remove bash version of script --- res/lang/fix_missing_entries.sh | 55 --------------------------------- 1 file changed, 55 deletions(-) delete mode 100644 res/lang/fix_missing_entries.sh diff --git a/res/lang/fix_missing_entries.sh b/res/lang/fix_missing_entries.sh deleted file mode 100644 index 8cdaae2..0000000 --- a/res/lang/fix_missing_entries.sh +++ /dev/null @@ -1,55 +0,0 @@ -#!/bin/bash - -set -eu - -function process_lang_file() { - local input_file=$1 - local -A lang_strings_in_file - - while read -r line; do - if [[ -z "$line" ]]; then - : - elif [[ "$line" =~ ^([^\ ]*)[\ ]?\=[\ ]?(.*) ]]; then - lang_strings_in_file["${BASH_REMATCH[1]}"]="${BASH_REMATCH[2]}" - else - echo "ERROR: Line '$line' in file '$input_file' does not contain an entry of the pattern ' = '. Exiting." >&2 - exit 1 - fi - done < "$input_file" - - { - for s in "${LANG_STRINGS[@]}"; do - if [[ -v "lang_strings_in_file[\"$s\"]" ]]; then - printf "%s = %s\n" "$s" "${lang_strings_in_file[$s]}" - else - printf "\n" - fi - done - } > "$input_file" -} - -LANG_DIR=$(dirname "$(realpath $0)") - -ZIG_LANG_FILE=$(realpath "$LANG_DIR/../../src/config/Lang.zig") - -if [ ! -f "$ZIG_LANG_FILE" ]; then - echo "ERROR: File '$ZIG_LANG_FILE' does not exist. Exiting." >&2 - exit 1 -fi - -declare -a LANG_STRINGS - -while read -r line; do - if [[ -z "$line" || "$line" =~ ^\/\/ ]]; then - : - elif [[ "$line" =~ ^([^:]*): ]]; then - LANG_STRINGS+=("${BASH_REMATCH[1]}") - else - echo "ERROR: Line '$line' in file '$ZIG_LANG_FILE' does not contain an entry of the pattern ': ...'." >&2 - exit 1 - fi -done < "$ZIG_LANG_FILE" - -for file in $LANG_DIR/*.ini; do - process_lang_file "$file" -done