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

Localize commands3 #642

Merged
merged 20 commits into from
Aug 18, 2022
Merged
Show file tree
Hide file tree
Changes from 14 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
44 changes: 41 additions & 3 deletions include/vcpkg/base/messages.h
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,12 @@ namespace vcpkg
return *this;
}

LocalizedString& append_nl()
{
m_data.append("\n");
return *this;
}

friend const char* to_printf_arg(const LocalizedString& s) { return s.data().c_str(); }

friend bool operator==(const LocalizedString& lhs, const LocalizedString& rhs)
Expand Down Expand Up @@ -407,6 +413,7 @@ namespace vcpkg
(msg::command_line),
"",
"'{command_line}' can only add one artifact at a time.");
DECLARE_MESSAGE(AddCommandFirstArg, (), "", "The first parameter to add must be 'artifact' or 'port'.");
DECLARE_MESSAGE(AddFirstArgument,
(msg::command_line),
"",
Expand Down Expand Up @@ -500,6 +507,7 @@ namespace vcpkg
"",
"Another installation is in progress on the machine, sleeping 6s before retrying.");
DECLARE_MESSAGE(AppliedUserIntegration, (), "", "Applied user-wide integration for this vcpkg root.");
DECLARE_MESSAGE(ArtifactsOptionIncompatibility, (msg::option), "", "--{option} has no effect on find artifact.");
DECLARE_MESSAGE(AttemptingToFetchPackagesFromVendor,
(msg::count, msg::vendor),
"",
Expand Down Expand Up @@ -659,6 +667,10 @@ namespace vcpkg
"{command_line}\n"
"failed with the following results:");
DECLARE_MESSAGE(CompressFolderFailed, (msg::path), "", "Failed to compress folder \"{path}\":");
DECLARE_MESSAGE(ControlAndManifestFilesPresent,
(msg::path),
"",
"Both a manifest file and a CONTROL file exist in port directory: {path}");
DECLARE_MESSAGE(CopyrightIsDir, (msg::path), "", "`{path}` being a directory is deprecated.");
DECLARE_MESSAGE(CouldNotDeduceNugetIdAndVersion,
(msg::path),
Expand Down Expand Up @@ -742,6 +754,7 @@ namespace vcpkg
(),
"",
"`vcpkg install` requires a list of packages to install in classic mode.");
DECLARE_MESSAGE(ErrorsFound, (), "", "Found the following errors:");
DECLARE_MESSAGE(
ErrorUnableToDetectCompilerInfo,
(),
Expand Down Expand Up @@ -769,18 +782,30 @@ namespace vcpkg
DECLARE_MESSAGE(ExpectedTripletName, (), "", "expected a triplet name here");
DECLARE_MESSAGE(ExtendedDocumenationAtUrl, (msg::url), "", "Extended documentation available at '{url}'.");
DECLARE_MESSAGE(FailedToExtract, (msg::path), "", "Failed to extract \"{path}\":");
DECLARE_MESSAGE(FailedToFormatMissingFile,
(),
"",
"No files to format.\nPlease pass either --all, or the explicit files to format or convert.");
DECLARE_MESSAGE(FailedToObtainLocalPortGitSha, (), "", "Failed to obtain git SHAs for local ports.");
DECLARE_MESSAGE(FailedToParseCMakeConsoleOut,
(),
"",
"Failed to parse CMake console output to locate block start/end markers.");
DECLARE_MESSAGE(FailedToParseControl, (msg::path), "", "Failed to parse control file: {path}");
DECLARE_MESSAGE(FailedToParseJson, (msg::path), "", "Failed to parse JSON file {path}");
DECLARE_MESSAGE(FailedToParseManifest, (msg::path), "", "Failed to parse manifest file: {path}");
DECLARE_MESSAGE(FailedToProvisionCe, (), "", "Failed to provision vcpkg-ce.");
DECLARE_MESSAGE(FailedToRead, (msg::path, msg::error_msg), "", "Failed to read {path}: {error_msg}");
DECLARE_MESSAGE(FailedToReadParagraph, (msg::path), "", "Failed to read paragraphs from {path}");
DECLARE_MESSAGE(FailedToRemoveControl, (msg::path), "", "Failed to remove control file {path}");
DECLARE_MESSAGE(FailedToRunToolToDetermineVersion,
(msg::tool_name, msg::path),
"Additional information, such as the command line output, if any, will be appended on "
"the line after this message",
"Failed to run \"{path}\" to determine the {tool_name} version.");
DECLARE_MESSAGE(FailedToStoreBackToMirror, (), "", "failed to store back to mirror:");
DECLARE_MESSAGE(FailedToStoreBinaryCache, (msg::path), "", "Failed to store binary cache {path}");
DECLARE_MESSAGE(FailedToWriteManifest, (msg::path), "", "Failed to write manifest file {path}");
DECLARE_MESSAGE(FailedVendorAuthentication,
(msg::vendor, msg::url),
"",
Expand Down Expand Up @@ -919,8 +944,6 @@ namespace vcpkg
(msg::actual),
"{actual} is the provided format string",
"invalid format string: {actual}");
DECLARE_MESSAGE(JsonErrorFailedToParse, (msg::path), "", "failed to parse {path}:");
DECLARE_MESSAGE(JsonErrorFailedToRead, (msg::path, msg::error_msg), "", "failed to read {path}: {error_msg}");
DECLARE_MESSAGE(JsonErrorMustBeAnObject, (msg::path), "", "Expected \"{path}\" to be an object.");
DECLARE_MESSAGE(LaunchingProgramFailed,
(msg::tool_name),
Expand Down Expand Up @@ -1018,8 +1041,18 @@ namespace vcpkg
"{value} is a localized message name like LocalizedMessageMustNotEndWithNewline",
"The message named {value} ends with a newline which should be added by formatting "
"rather than by localization.");
DECLARE_MESSAGE(ManifestFormatCompleted, (), "", "Succeeded in formatting the manifest files.");
DECLARE_MESSAGE(Missing7zHeader, (), "", "Unable to find 7z header.");
DECLARE_MESSAGE(MissingArgFormatManifest,
(),
"",
"format-manifest was passed --convert-control without '--all'.\nThis doesn't do anything: we will "
"automatically convert all control files passed explicitly.");
DECLARE_MESSAGE(MissingExtension, (msg::extension), "", "Missing '{extension}' extension.");
DECLARE_MESSAGE(MissingPortSuggestPullRequest,
(),
"",
"If your port is not listed, please open an issue at and/or consider making a pull request.");
DECLARE_MESSAGE(MonoInstructions,
(),
"",
Expand Down Expand Up @@ -1131,6 +1164,11 @@ namespace vcpkg
"The 'Source' field inside the CONTROL file, or \"name\" field inside the vcpkg.json "
"file has the name {package_name} and does not match the port directory \"{path}\".");
DECLARE_MESSAGE(StoredBinaryCache, (msg::path), "", "Stored binary cache: \"{path}\"");
DECLARE_MESSAGE(SuggestGitPull, (), "", "The result may be outdated. Run `git pull` to get the latest results.");
DECLARE_MESSAGE(SuggestResolution,
(msg::command_name, msg::option),
"",
"To attempt to resolve all errors at once, run:\nvcpkg {command_name} --{option}");
DECLARE_MESSAGE(SuggestStartingBashShell,
(),
"",
Expand Down Expand Up @@ -1302,4 +1340,4 @@ namespace vcpkg
"The message named {value} starts with warning:, it must be changed to prepend "
"WarningMessage in code instead.");
DECLARE_MESSAGE(WarningsTreatedAsErrors, (), "", "previous warnings being interpreted as errors");
}
}
20 changes: 18 additions & 2 deletions locales/messages.en.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"AddArtifactOnlyOne": "'{command_line}' can only add one artifact at a time.",
"AddCommandFirstArg": "The first parameter to add must be 'artifact' or 'port'.",
"AddFirstArgument": "The first argument to '{command_line}' must be 'artifact' or 'port'.",
"AddPortRequiresManifest": "'{command_line}' requires an active manifest file.",
"AddPortSucceeded": "Succeeded in adding ports to vcpkg.json file.",
Expand Down Expand Up @@ -37,6 +38,7 @@
"AlreadyInstalledNotHead": "{spec} is already installed -- not building from HEAD",
"AnotherInstallationInProgress": "Another installation is in progress on the machine, sleeping 6s before retrying.",
"AppliedUserIntegration": "Applied user-wide integration for this vcpkg root.",
"ArtifactsOptionIncompatibility": "--{option} has no effect on find artifact.",
"AttemptingToFetchPackagesFromVendor": "Attempting to fetch {count} package(s) from {vendor}",
"AuthenticationMayRequireManualAction": "One or more {vendor} credential providers requested manual action. Add the binary source 'interactive' to allow interactivity.",
"AutoSettingEnvVar": "-- Automatically setting {env_var} environment variables to \"{url}\".",
Expand Down Expand Up @@ -77,6 +79,7 @@
"CmakeTargetsExcluded": "note: {count} additional targets are not displayed.",
"CommandFailed": "command:\n{command_line}\nfailed with the following results:",
"CompressFolderFailed": "Failed to compress folder \"{path}\":",
"ControlAndManifestFilesPresent": "Both a manifest file and a CONTROL file exist in port directory: {path}",
"CopyrightIsDir": "`{path}` being a directory is deprecated.",
"CouldNotDeduceNugetIdAndVersion": "Could not deduce nuget id and version from filename: {path}",
"CreatedNuGetPackage": "Created nupkg: \"{path}\"",
Expand Down Expand Up @@ -109,18 +112,28 @@
"ErrorVcvarsUnsupported": "in triplet {triplet}: Use of Visual Studio's Developer Prompt is unsupported on non-Windows hosts.\nDefine 'VCPKG_CMAKE_SYSTEM_NAME' or 'VCPKG_CHAINLOAD_TOOLCHAIN_FILE' in the triplet file.",
"ErrorVsCodeNotFound": "Visual Studio Code was not found and the environment variable {env_var} is not set or invalid.",
"ErrorVsCodeNotFoundPathExamined": "The following paths were examined:",
"ErrorsFound": "Found the following errors:",
"ExcludedPackage": "Excluded {spec}",
"ExpectedCharacterHere": "expected '{expected}' here",
"ExpectedFailOrSkip": "expected 'fail', 'skip', or 'pass' here",
"ExpectedPortName": "expected a port name here",
"ExpectedTripletName": "expected a triplet name here",
"ExtendedDocumenationAtUrl": "Extended documentation available at '{url}'.",
"FailedToExtract": "Failed to extract \"{path}\":",
"FailedToFormatMissingFile": "No files to format.\nPlease pass either --all, or the explicit files to format or convert.",
"FailedToObtainLocalPortGitSha": "Failed to obtain git SHAs for local ports.",
"FailedToParseCMakeConsoleOut": "Failed to parse CMake console output to locate block start/end markers.",
"FailedToParseControl": "Failed to parse control file: {path}",
"FailedToParseJson": "Failed to parse JSON file {path}",
"FailedToParseManifest": "Failed to parse manifest file: {path}",
"FailedToProvisionCe": "Failed to provision vcpkg-ce.",
"FailedToRead": "Failed to read {path}: {error_msg}",
"FailedToReadParagraph": "Failed to read paragraphs from {path}",
"FailedToRemoveControl": "Failed to remove control file {path}",
"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}",
"FailedToWriteManifest": "Failed to write manifest file {path}",
"FailedVendorAuthentication": "One or more {vendor} credential providers failed to authenticate. See '{url}' for more details on how to provide credentials.",
"FeedbackAppreciated": "Thank you for your feedback!",
"FishCompletion": "vcpkg fish completion is already added at \"{path}\".",
Expand Down Expand Up @@ -165,8 +178,6 @@
"InvalidArgumentRequiresTwoOrThreeArguments": "invalid argument: binary config '{binary_source}' requires 2 or 3 arguments",
"InvalidArgumentRequiresValidToken": "invalid argument: binary config '{binary_source}' requires a SAS token without a preceeding '?' as the second argument",
"InvalidFormatString": "invalid format string: {actual}",
"JsonErrorFailedToParse": "failed to parse {path}:",
"JsonErrorFailedToRead": "failed to read {path}: {error_msg}",
"JsonErrorMustBeAnObject": "Expected \"{path}\" to be an object.",
"LaunchingProgramFailed": "Launching {tool_name}:",
"LicenseExpressionContainsExtraPlus": "SPDX license expression contains an extra '+'. These are only allowed directly after a license identifier.",
Expand All @@ -191,8 +202,11 @@
"LoadingOverlayTriplet": "-- [OVERLAY] Loading triplet configuration from: {path}",
"LocalizedMessageMustNotContainIndents": "The message named {value} contains what appears to be indenting which must be changed to use LocalizedString::append_indent instead.",
"LocalizedMessageMustNotEndWithNewline": "The message named {value} ends with a newline which should be added by formatting rather than by localization.",
"ManifestFormatCompleted": "Succeeded in formatting the manifest files.",
"Missing7zHeader": "Unable to find 7z header.",
"MissingArgFormatManifest": "format-manifest was passed --convert-control without '--all'.\nThis doesn't do anything: we will automatically convert all control files passed explicitly.",
"MissingExtension": "Missing '{extension}' extension.",
"MissingPortSuggestPullRequest": "If your port is not listed, please open an issue at and/or consider making a pull request.",
"MonoInstructions": "This may be caused by an incomplete mono installation. Full mono is available on some systems via `sudo apt install mono-complete`. Ubuntu 18.04 users may need a newer version of mono, available at https://www.mono-project.com/download/stable/",
"MsiexecFailedToExtract": "msiexec failed while extracting \"{path}\" with launch or exit code {exit_code} and message:",
"NavigateToNPS": "Please navigate to {url} in your preferred browser.",
Expand Down Expand Up @@ -232,6 +246,8 @@
"SettingEnvVar": "-- Setting \"{env_var}\" environment variables to \"{url}\".",
"SourceFieldPortNameMismatch": "The 'Source' field inside the CONTROL file, or \"name\" field inside the vcpkg.json file has the name {package_name} and does not match the port directory \"{path}\".",
"StoredBinaryCache": "Stored binary cache: \"{path}\"",
"SuggestGitPull": "The result may be outdated. Run `git pull` to get the latest results.",
"SuggestResolution": "To attempt to resolve all errors at once, run:\nvcpkg {command_name} --{option}",
"SuggestStartingBashShell": "Please make sure you have started a new bash shell for the change to take effect.",
"SupportedPort": "Port {package_name} is supported.",
"SystemApiErrorMessage": "calling {system_api} failed with {exit_code} ({error_msg})",
Expand Down
Loading