Skip to content

Commit a0c97c9

Browse files
committed
tools/check-messages-en: Check for straight quotes in messages
We caught all the straight quotes in f8351f0, but it looks like one crept in after that. Add this check so it doesn't happen again.
1 parent 1d2868a commit a0c97c9

File tree

3 files changed

+16
-2
lines changed

3 files changed

+16
-2
lines changed

src/chat/InvalidNarrow.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ type Props = $ReadOnly<{|
2727
export default function InvalidNarrow(props: Props): Node {
2828
return (
2929
<View style={styles.container}>
30-
<ZulipTextIntl style={styles.text} text="That conversation doesn't seem to exist." />
30+
<ZulipTextIntl style={styles.text} text="That conversation doesnt seem to exist." />
3131
</View>
3232
);
3333
}

static/translations/messages_en.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@
119119
"Username": "Username",
120120
"Password": "Password",
121121
"Why not start the conversation?": "Why not start the conversation?",
122-
"That conversation doesn't seem to exist.": "That conversation doesn't seem to exist.",
122+
"That conversation doesnt seem to exist.": "That conversation doesnt seem to exist.",
123123
"Request timed out.": "Request timed out.",
124124
"Sign in with {method}": "Sign in with {method}",
125125
"Invalid input": "Invalid input",

tools/check-messages-en

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,20 @@ function getPossibleUiStrings(possibleUiStringFilePaths) {
165165
}
166166

167167
function main() {
168+
// Mobile's style is to use curly quotes. They look nicer, but also: since
169+
// v3, react-intl uses the single straight quote as an escape character:
170+
// https://formatjs.io/docs/intl-messageformat/#features
171+
const messagesWithStraightQuotes = Object.values(messages_en).filter(message =>
172+
/['"]/.test(message),
173+
);
174+
if (messagesWithStraightQuotes.length > 0) {
175+
console.error(
176+
'Found messages in static/translations/messages_en.json that have straight quotes. Please use smart quotes: “” and ‘’.',
177+
);
178+
console.error(messagesWithStraightQuotes);
179+
process.exit(1);
180+
}
181+
168182
const possibleUiStrings = getPossibleUiStrings(getPossibleUiStringFilePaths());
169183

170184
// Check each key ("message ID" in formatjs's lingo) against

0 commit comments

Comments
 (0)