aboutsummaryrefslogtreecommitdiffstats
path: root/sync-translations.sh
diff options
context:
space:
mode:
authorJason A. Donenfeld <Jason@zx2c4.com>2020-12-17 00:40:42 +0100
committerJason A. Donenfeld <Jason@zx2c4.com>2020-12-17 00:40:42 +0100
commit49b7d083f1d4b207a51a855bd1ec8cc7abb34c52 (patch)
treefb482bdc67a16253f5c13030731c6adc31a6f70b /sync-translations.sh
parentKit: Adapter: do not treat NE settings timeouts as fatal (diff)
downloadwireguard-apple-49b7d083f1d4b207a51a855bd1ec8cc7abb34c52.tar.xz
wireguard-apple-49b7d083f1d4b207a51a855bd1ec8cc7abb34c52.zip
UI: add missing translations to incomplete locales
This is the wrong way to fix the problem. The correct way will involve moving away from the whacky tr() macro and using translations functions properly. But migrating to that will require some heavy scripting work. So for now, use a hammer. Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Diffstat (limited to 'sync-translations.sh')
-rwxr-xr-xsync-translations.sh17
1 files changed, 17 insertions, 0 deletions
diff --git a/sync-translations.sh b/sync-translations.sh
index f789010..26b64f8 100755
--- a/sync-translations.sh
+++ b/sync-translations.sh
@@ -3,6 +3,23 @@ set -e
curl -Lo - https://crowdin.com/backend/download/project/wireguard.zip | bsdtar -C Sources/WireGuardApp -x -f - --strip-components 3 wireguard-apple
find Sources/WireGuardApp/*.lproj -type f -empty -delete
find Sources/WireGuardApp/*.lproj -type d -empty -delete
+declare -A ALL_BASE
+while read -r key eq rest; do
+ [[ $key == \"* && $key == *\" && $eq == = ]] || continue
+ ALL_BASE["$key"]="$rest"
+done < Sources/WireGuardApp/Base.lproj/Localizable.strings
+for f in Sources/WireGuardApp/*.lproj/Localizable.strings; do
+ unset FOUND
+ declare -A FOUND
+ while read -r key eq _; do
+ [[ $key == \"* && $key == *\" && $eq == = ]] || continue
+ FOUND["$key"]=1
+ done < "$f"
+ for key in "${!ALL_BASE[@]}"; do
+ [[ ${FOUND["$key"]} -eq 1 ]] && continue
+ echo "$key = ${ALL_BASE["$key"]}"
+ done >> "$f"
+done < Sources/WireGuardApp/Base.lproj/Localizable.strings
git add Sources/WireGuardApp/*.lproj
declare -A LOCALE_MAP