Add script to check apostrophe style

The script checks for straight apostrophes in our
user-facing strings since curly ones shall be used
per an internal decision. It generates an error on
matches in our English strings, since those are
our source of truth.
This commit is contained in:
Albin committed 2026-04-28 20:25:02 +02:00
1 parent c54e490806
commit f97145e49b
1 file changed
+29
+29
View File
@@ -0,0 +1,29 @@
#!/usr/bin/env bash
set -eu
CURLY_APOSTROPHE_STYLE="’"
UNSUPPORTED_APOSTROPHE_STYLES="'\`´'′ʼ"
ERROR_MESSAGE="Error: Use curly apostrophes ($CURLY_APOSTROPHE_STYLE) \
instead of unsupported ones ($UNSUPPORTED_APOSTROPHE_STYLES)."
# Check Desktop/Android strings (English only).
if grep "^msgid" desktop/packages/mullvad-vpn/locales/messages.pot | \
grep "[$UNSUPPORTED_APOSTROPHE_STYLES]"; then
echo "$ERROR_MESSAGE"
exit 1
fi
# Check Android strings (English only).
if awk '/<string/,/<\/string>/' \
android/lib/ui/resource/src/main/res/values/strings.xml | \
grep "[$UNSUPPORTED_APOSTROPHE_STYLES]"; then
echo "$ERROR_MESSAGE"
exit 1
fi
# Check iOS strings (English only).
if jq -r '.strings | keys[]' ios/Assets/Localizable.xcstrings | \
grep "[$UNSUPPORTED_APOSTROPHE_STYLES]"; then
echo "$ERROR_MESSAGE"
exit 1
fi