diff options
author | Jason A. Donenfeld <Jason@zx2c4.com> | 2020-12-17 12:41:23 +0100 |
---|---|---|
committer | Jason A. Donenfeld <Jason@zx2c4.com> | 2020-12-17 12:41:23 +0100 |
commit | 403ee63615976181dd1efe08a260e1f8d391d5a0 (patch) | |
tree | ca57c339fd54784f4391c5bc977443165b625a11 /sync-translations.sh | |
parent | build: disable hardened runtime on iOS but keep it enabled on macOS (diff) | |
download | wireguard-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-x | sync-translations.sh | 8 |
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 |