From f97145e49b741676d718e2db9aed9e4e0c98e27e Mon Sep 17 00:00:00 2001 From: Albin Date: Tue, 28 Apr 2026 20:25:02 +0200 Subject: [PATCH] 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. --- scripts/check-apostrophe-style | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100755 scripts/check-apostrophe-style diff --git a/scripts/check-apostrophe-style b/scripts/check-apostrophe-style new file mode 100755 index 0000000000..22db2f6df0 --- /dev/null +++ b/scripts/check-apostrophe-style @@ -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 '//' \ + 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