From 26708305d6a0cdf689c42afd29f3d27bcd701a02 Mon Sep 17 00:00:00 2001 From: Bernd Storath <999999bst@gmail.com> Date: Wed, 12 Nov 2025 08:23:44 +0100 Subject: [PATCH] add script to calculate i18n progress --- scripts/i18n.sh | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100755 scripts/i18n.sh diff --git a/scripts/i18n.sh b/scripts/i18n.sh new file mode 100755 index 00000000..4d6de690 --- /dev/null +++ b/scripts/i18n.sh @@ -0,0 +1,19 @@ +#!/bin/bash + +folder="src/i18n/locales" +base_file="$folder/en.json" + +# Get all leaf keys from the English base file +base_keys=$(jq -r 'paths(scalars) | map(tostring) | join(".")' "$base_file") +total=$(echo "$base_keys" | wc -l) + +# Loop through all JSON files in the folder +for file in "$folder"/*.json; do + name=$(basename "$file" .json) + translated_keys=$(jq -r 'paths(scalars) | map(tostring) | join(".")' "$file") + done=$(comm -12 <(echo "$base_keys" | sort) <(echo "$translated_keys" | sort) | wc -l) + percent=$((100 * done / total)) + check="[ ]" + [ "$percent" -eq 100 ] && check="[x]" + printf "%s %s (%d%%)\n" "- $check" "$name" "$percent" +done \ No newline at end of file