-
Notifications
You must be signed in to change notification settings - Fork 287
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
Remove {Locked} from localization machinery and localize the version command. #463
Conversation
src/vcpkg.cpp
Outdated
@@ -336,16 +320,23 @@ int main(const int argc, const char* const* const argv) | |||
LockGuardPtr<Metrics>(g_metrics)->track_property("error", exc_msg); | |||
|
|||
fflush(stdout); | |||
msg::println(msgVcpkgHasCrashed, msg::email = Commands::Contact::email()); | |||
msg::println(LocalizedString::from_raw("vcpkg.exe has crashed.")); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This PR preserves the previous behavior, but I think this should be localized?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Side note, everyone I know from Mexico Spanglishes "has crashed" as "crasheo".
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It looks to me like this was actually localized before.
DECLARE_AND_REGISTER_MESSAGE(VcpkgHasCrashed, (msg::email), "", R"(vcpkg.exe has crashed...)");
Just this section was locked previously.
DECLARE_AND_REGISTER_MESSAGE(VcpkgHasCrashedDataBlob,
(msg::version, msg::error),
"{Locked}",
R"(
Version={version}
EXCEPTION='{error}'
CMD=)");
msg.append(LocalizedString() | ||
.append_indent() | ||
.append_raw(fmt::format("target_link_libraries(main PRIVATE {})", | ||
Strings::join(" ", targets))) | ||
.appendnl() | ||
.appendnl() | ||
.extract_data()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
msg.append(LocalizedString() | |
.append_indent() | |
.append_raw(fmt::format("target_link_libraries(main PRIVATE {})", | |
Strings::join(" ", targets))) | |
.appendnl() | |
.appendnl() | |
.extract_data()); | |
msg.append(fmt::format("target_link_libraries(main PRIVATE {})\n\n", Strings::join(" ", targets)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You lost the indent here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM with Victor's and my comments.
src/vcpkg.cpp
Outdated
fflush(stdout); | ||
for (int x = 0; x < argc; ++x) | ||
{ | ||
#if defined(_WIN32) | ||
msg::println(msgVcpkgHasCrashedArgument, msg::value = Strings::to_utf8(argv[x])); | ||
msg::println(LocalizedString::from_raw(Strings::to_utf8(argv[x]) + "|")); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Printing for each line here kinda sucks; I'd rather do something like:
LocalizedString arguments;
for (...) {
arguments.append_raw(Strings::to_utf8(argv[x])).append_raw("|").append_nl();
}
Co-authored-by: Robert Schumacher <roschuma@microsoft.com>
src/vcpkg.cpp
Outdated
LocalizedString data_blob; | ||
data_blob.append_raw("Version=").append_raw(Commands::Version::version).appendnl(); | ||
data_blob.append_raw("EXCEPTION=").append_raw(exc_msg).appendnl(); | ||
data_blob.append_raw("CMD=").appendnl(); | ||
for (int x = 0; x < argc; ++x) | ||
{ | ||
#if defined(_WIN32) | ||
msg::println(LocalizedString::from_raw(Strings::to_utf8(argv[x]) + "|")); | ||
data_blob.append_raw(Strings::to_utf8(argv[x])).append_raw("|").appendnl(); | ||
#else | ||
msg::println(LocalizedString::from_raw(std::string(argv[x]) + "|")); | ||
data_blob.append_raw(argv[x]).append_raw("|").appendnl(); | ||
#endif | ||
} | ||
|
||
msg::print(data_blob); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LocalizedString data_blob; | |
data_blob.append_raw("Version=").append_raw(Commands::Version::version).appendnl(); | |
data_blob.append_raw("EXCEPTION=").append_raw(exc_msg).appendnl(); | |
data_blob.append_raw("CMD=").appendnl(); | |
for (int x = 0; x < argc; ++x) | |
{ | |
#if defined(_WIN32) | |
msg::println(LocalizedString::from_raw(Strings::to_utf8(argv[x]) + "|")); | |
data_blob.append_raw(Strings::to_utf8(argv[x])).append_raw("|").appendnl(); | |
#else | |
msg::println(LocalizedString::from_raw(std::string(argv[x]) + "|")); | |
data_blob.append_raw(argv[x]).append_raw("|").appendnl(); | |
#endif | |
} | |
msg::print(data_blob); | |
std::string msg = Strings::concat("Version=", Commands::Version::version, "\n", "EXCEPTION=", exc_msg, "\n", "CMD=\n"); | |
for (int x = 0; x < argc; ++x) | |
{ | |
#if defined(_WIN32) | |
Strings::append(msg, Strings::to_utf8(argv[x]), "|\n"); | |
#else | |
Strings::append(msg, argv[x], "|\n"); | |
#endif | |
} | |
print2(msg); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This goes backwards: the intent is for that everything that has been audited for localization goes through msg::print so that a 'find all references' on print2 finds everything yet to be fixed.
src/vcpkg/commands.version.cpp
Outdated
VersionCommandHeader, | ||
(msg::version), | ||
"", | ||
"Vcpkg package management program version {version}\n\nSee LICENSE.txt for license information."); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"Vcpkg package management program version {version}\n\nSee LICENSE.txt for license information."); | |
"vcpkg package management program version {version}\n\nSee LICENSE.txt for license information."); |
nit, but it's spelled vcpkg
; close as wontfix if you don't want to change behaviour
/azp run |
Azure Pipelines successfully started running 1 pipeline(s). |
No description provided.