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

Delocalize error: warning: and note:. #1260

Merged
merged 2 commits into from Oct 31, 2023

Conversation

BillyONeal
Copy link
Member

@BillyONeal BillyONeal commented Oct 30, 2023

Response to code review comment #1239 (comment)

I spoke with localization team and compiler team and not localizing these are what the compiler does.

inline constexpr StringLiteral InternalErrorPrefix = "internal error: ";
inline constexpr StringLiteral NotePrefix = "note: ";
inline constexpr StringLiteral WarningPrefix = "warning: ";

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
LocalizedString error_prefix();
LocalizedString internal_error_prefix();
LocalizedString note_prefix();
LocalizedString warning_prefix();

These are used widely enough that I think it improves clarity:

LocalizedString::from_raw(ErrorPrefix).append(msgMyErrorStuff)

to

error_prefix().append(msgMyErrorStuff)

Comment on lines 39 to 46
if (kind == MessageKind::Warning)
{
res.append(msgWarningMessage);
res.append_raw(WarningPrefix);
}
else
{
res.append(msgErrorMessage);
res.append_raw(ErrorPrefix);
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if (kind == MessageKind::Warning)
{
res.append(msgWarningMessage);
res.append_raw(WarningPrefix);
}
else
{
res.append(msgErrorMessage);
res.append_raw(ErrorPrefix);
}
res.append_raw(kind == MessageKind::Warning ? WarningPrefix : ErrorPrefix);

}

if (!mismatches.arguments_without_comment.empty() || !mismatches.comments_without_argument.empty())
{
has_errors = true;
msg::println_error(msgGenerateMsgIncorrectComment, msg::value = msg.name);
msg::print(LocalizedString::from_raw(ErrorPrefix)
.append_raw(fmt::format("message {} has an incorrect comment:\n", msg.name)));

for (const auto& arg : mismatches.arguments_without_comment)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Double check these -- the message seems opposite from the member name arguments_without_comment.

@BillyONeal BillyONeal merged commit f9df9b3 into microsoft:main Oct 31, 2023
5 checks passed
@BillyONeal BillyONeal deleted the delocalize-error-warning branch October 31, 2023 23:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants