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

Localization of strings in binarycaching.cpp #606

Merged
merged 11 commits into from
Jul 1, 2022

Conversation

JavierMatosD
Copy link
Contributor

Localization of strings in binarycaching.cpp
Sorted Declared/Registered messages in alphabetical order.

- Sorted Declared/Registered messages in alphabetical order.
Copy link
Member

@vicroms vicroms left a comment

Choose a reason for hiding this comment

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

Partial review

Copy link
Member

@BillyONeal BillyONeal left a comment

Choose a reason for hiding this comment

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

Waiting specifically for the help text / table thing, the rest are nitpicks.

Comment on lines 61 to 64
DECLARE_AND_REGISTER_MESSAGE(HelpTableFormat,
(msg::value),
"'{value}' is vcpkg::HelpTableFormatter as a string.",
"'{value}'");
Copy link
Member

Choose a reason for hiding this comment

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

This seems wrong: The old code just printed the thing, this is adding extra 's around it?

It seems like the thing itself needs to be localized rather than being washed through format like this.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I will probably rewrite the HelpTableFormatter to require LocalizedString as input. I'll open another PR for that specifically.

print2(tbl.m_str);

print2("\nExtended documentation is available at ", docs::assetcaching_url, "\n");
msg::println(msgHelpTableFormat, msg::value = tbl.m_str);
Copy link
Member

Choose a reason for hiding this comment

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

Here the content that actually needs to be localized is the help text blocks above rather than this part.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Same as before

"invalid argument: binary config '{binary_source}' requires at least a prefix");
DECLARE_AND_REGISTER_MESSAGE(InvalidArgumentRequiresSource,
(msg::binary_source),
"Extendend documentation available at '{url}'.");
Copy link
Member

Choose a reason for hiding this comment

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

I think it's OK to just put the URL into the localized message, IMO. But I think we are inconsistent about that at the moment...

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I am hoping to be able to reuse some of these messages in the future. Passing the URL in as an argument allows me to do that.

Copy link
Member

Choose a reason for hiding this comment

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

Hmmmmm I don't know if we have another place that tries to do that but sounds OK

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Actually, I just realized that InvalidArgumentRequiresSource is repetitive since there is already an InvalidArgumentRequiresSourceArgument message (which is also used several times throughout the file).

Removed HelpTableFormat message. The HelpTableFormatter needs to be updated to require LocalizedString as input. I intend to do this work in a separate PR.
"FailedToProvisionCe": "Failed to provision vcpkg-ce.",
"FailedToRunToolToDetermineVersion": "Failed to run {path} to determine the {tool_name} version.",
"FailedToStoreBackToMirror": "failed to store back to mirror:",
"FailedToStoreBinaryCache": "Failed to store binary cache '{path}':'{error_msg}'",
"FailedVendorAuthentication": "One or more {vendor} credential providers failed to authenticate. See '{url}' for more detailson how to provide credentials.",
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
"FailedVendorAuthentication": "One or more {vendor} credential providers failed to authenticate. See '{url}' for more detailson how to provide credentials.",
"FailedVendorAuthentication": "One or more {vendor} credential providers failed to authenticate. See '{url}' for more details on how to provide credentials.",

Copy link
Member

Choose a reason for hiding this comment

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

Note that the json files shouldn't be edited by hand: the C++ code that created these entries should be fixed and generate-messages rerun.

Copy link
Member

Choose a reason for hiding this comment

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

Ah, yes. I've added the comments on the related code changes.

"RemovingPackage": "Removing {action_index}/{count} {spec}",
"RestoredPackagesFromVendor": "Restored {count} package(s) from {vendor} in {elapsed}",
"ReplaceSecretsError": "'{error_msg}'",
Copy link
Member

@vicroms vicroms Jun 30, 2022

Choose a reason for hiding this comment

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

I don't agree with registering a localizable string just to surround it with '. Probably should use raw format here.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I could just add a statement before the error message. Something like "Replace secretes produced the following error: '{error_msg}'." Is that cool with you or would you prefer to just write unlocalized to stdout?

Copy link
Member

Choose a reason for hiding this comment

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

Yeah, we should add context to the message.

@JavierMatosD JavierMatosD requested a review from vicroms July 1, 2022 22:22
Copy link
Member

@vicroms vicroms left a comment

Choose a reason for hiding this comment

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

LGTM

@JavierMatosD JavierMatosD merged commit 4ab08e5 into microsoft:main Jul 1, 2022
@JavierMatosD JavierMatosD deleted the localization branch July 1, 2022 22:36
@JavierMatosD JavierMatosD restored the localization branch July 1, 2022 22:42
@JavierMatosD JavierMatosD deleted the localization branch April 20, 2023 19:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants