aboutsummaryrefslogtreecommitdiffstats
path: root/sync-translations.sh
diff options
context:
space:
mode:
authorJason A. Donenfeld <Jason@zx2c4.com>2020-12-17 12:41:23 +0100
committerJason A. Donenfeld <Jason@zx2c4.com>2020-12-17 12:41:23 +0100
commit403ee63615976181dd1efe08a260e1f8d391d5a0 (patch)
treeca57c339fd54784f4391c5bc977443165b625a11 /sync-translations.sh
parentbuild: disable hardened runtime on iOS but keep it enabled on macOS (diff)
downloadwireguard-apple-403ee63615976181dd1efe08a260e1f8d391d5a0.tar.xz
wireguard-apple-403ee63615976181dd1efe08a260e1f8d391d5a0.zip
project: generate more stable locale IDs
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Diffstat (limited to 'sync-translations.sh')
-rwxr-xr-xsync-translations.sh8
1 files changed, 6 insertions, 2 deletions
diff --git a/sync-translations.sh b/sync-translations.sh
index 26b64f8..c855aab 100755
--- a/sync-translations.sh
+++ b/sync-translations.sh
@@ -23,11 +23,14 @@ done < Sources/WireGuardApp/Base.lproj/Localizable.strings
git add Sources/WireGuardApp/*.lproj
declare -A LOCALE_MAP
+[[ $(< WireGuard.xcodeproj/project.pbxproj) =~ [[:space:]]([0-9A-F]{24})\ /\*\ Base\ \*/, ]]
+base_id="${BASH_REMATCH[1]:0:16}"
+idx=$(( "0x${BASH_REMATCH[1]:16}" ))
while read -r filename; do
l="$(basename "$(dirname "$filename")" .lproj)"
[[ $l == Base ]] && continue
- read -r -n 24 hex < <(LC_ALL=C tr -dc "A-F0-9" < /dev/urandom)
- LOCALE_MAP["$l"]="$hex"
+ ((++idx))
+ LOCALE_MAP["$l"]="$(printf '%s%08X' "$base_id" $idx)"
done < <(find Sources/WireGuardApp -name Localizable.strings -type f)
inkr=0 inls=0 inlsc=0
@@ -43,6 +46,7 @@ while IFS= read -r line; do
echo "$line"
printf '\t\t\t\tBase,\n\t\t\t\ten,\n'
for l in "${!LOCALE_MAP[@]}"; do
+ [[ $l == *-* ]] && l="\"$l\""
printf '\t\t\t\t%s,\n' "$l"
done
inkr=1