Skip to content

Commit 3fdca87

Browse files
Warn about unmatched variables when using curly braces with modifiers
1 parent cf84ac5 commit 3fdca87

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

rosetta/static/admin/rosetta/js/rosetta.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ document.addEventListener("DOMContentLoaded", () => {
153153
// Show warning if the variables in the original and the translation don't match
154154
function validateTranslation(textarea) {
155155
const orig = originalForTextarea(textarea);
156-
const variablePattern = /%(?:\([^\s)]*\))?[sdf]|\{[\w\d_]+?\}/g;
156+
const variablePattern = /%(?:\([^\s)]*\))?[sdf]|\{[^\s}]*\}/g;
157157
const origVars = orig.match(variablePattern) || [];
158158
const transVars = textarea.value.match(variablePattern) || [];
159159
const everyOrigVarUsed = origVars.every((origVar) => transVars.includes(origVar));

0 commit comments

Comments
 (0)