Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Be consistent in how we're generating string interpolations #192

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion lib/src/intl_suggestors/intl_message_syntax.dart
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,11 @@ class MessageSyntax {

String nameForNode(StringLiteral body,
{String? initialName, bool startAtZero = false}) {
var messageText = body.toSource();
// If the body is an interpolation, make sure we generate it the same way we will see it in
// the final file, otherwise comparisons may fail. Notably, be sure we always use ${} form.
var messageText = body is StringInterpolation
? intlParameterizedMessage(body)
: body.toSource();
var functionName = toVariableName(messageText);
functionName = owner.nameForString(initialName ?? functionName, messageText,
startAtZero: startAtZero);
Expand Down