From a0fca6d96c4fcec1c519ae2f5df7b06b6dc86e90 Mon Sep 17 00:00:00 2001 From: pvillaverde Date: Sun, 5 Mar 2023 13:32:32 +0100 Subject: [PATCH] Add script for updating translations --- src/lang/extra/_checkMissingTranslations.sh | 31 +++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100755 src/lang/extra/_checkMissingTranslations.sh diff --git a/src/lang/extra/_checkMissingTranslations.sh b/src/lang/extra/_checkMissingTranslations.sh new file mode 100755 index 0000000000..6fe5512425 --- /dev/null +++ b/src/lang/extra/_checkMissingTranslations.sh @@ -0,0 +1,31 @@ +#!/bin/bash + +if [ $# -eq 0 ]; then + echo "Please specify a language file to update" + exit 1 +fi + +language_file="$1" + +# Check that the specified file exists +if [ ! -f "$language_file" ]; then + echo "File not found: $language_file" + exit 1 +fi + +# Read each line from the English file and check if it exists in the language file +while read -r line; do + # Skip lines that start with # + if [[ $line =~ ^#.* ]]; then + continue + fi + # Extract the string code from the English line + STRING_CODE=$(echo $line | cut -d' ' -f1) + # Check if the string code exists in the language file + if ! grep -qw "$STRING_CODE" "$language_file"; then + # If the line doesn't exist, add it to the end of the language file + continue + echo "$line" >>"$language_file" + echo "Added missing line to $language_file: $line" + fi +done <"english.txt"