You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hello, $& and $'!
Total: $$5.00 (gift)
Total: {{note}} (gift)
Hello, {{name}}!
"Great day ..."
Parameter values in $t should be inserted verbatim without String.prototype.replace$-pattern expansion or re-substitution by later parameters, parameter keys should be matched literally rather than compiled as raw regular expressions, and $truncate should slice by Unicode code points (or avoid splitting a surrogate pair, yielding "Great day ..." or "Great day \u{1F600}...").
Actual behavior
Hello, {{name}} and !!
Total: $5.00 (gift)
Total: gift (gift)
SyntaxError: Invalid regular expression: /\{\{na(me\}\}/g: Unterminated group
"Great day \ud83d..."
In packages/directives/src/i18n.ts, createI18nDirective loops over Object.entries(raw.params) and calls template.replace(new RegExp(`\\{\\{${paramKey}\\}\\}`, "g"), String(resolved)):
Passing String(resolved) as the replacement string expands $$, $&, $`, and $' in parameter values (for example, "$$5.00" loses a $ and "$&" expands to "{{name}}").
Mutating template on each iteration re-substitutes any {{otherParam}} text present in an earlier parameter's value.
Putting paramKey into new RegExp(...) without escaping throws SyntaxError on regex characters like ( or [, and matches . as any character.
In packages/directives/src/truncate.ts, text.slice(0, maxLength) slices UTF-16 code units, leaving a lone high surrogate (\ud83d, rendered as U+FFFD) when length falls inside a surrogate pair.
Activity