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] Monoceros #704

Merged
merged 13 commits into from
Oct 4, 2022
Merged
1 change: 1 addition & 0 deletions include/vcpkg/base/basic_checks.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ namespace vcpkg::Checks
// Indicate that an internal error has occurred and exit the tool. This should be used when invariants have been
// broken.
[[noreturn]] void unreachable(const LineInfo& line_info);
[[noreturn]] void unreachable(const LineInfo& line_info, StringView message);

[[noreturn]] void exit_with_code(const LineInfo& line_info, const int exit_code);

Expand Down
10 changes: 7 additions & 3 deletions include/vcpkg/base/files.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,15 @@
#include <vcpkg/base/fwd/span.h>

#include <vcpkg/base/checks.h>
#include <vcpkg/base/lineinfo.h>
#include <vcpkg/base/messages.h>
#include <vcpkg/base/pragmas.h>
#include <vcpkg/base/stringview.h>

#include <stdio.h>
#include <string.h>

#include <initializer_list>
#include <memory>
#include <system_error>

Expand All @@ -21,6 +24,10 @@

namespace vcpkg
{
LocalizedString format_filesystem_call_error(const std::error_code& ec,
StringView call_name,
std::initializer_list<StringView> args);

struct IgnoreErrors
{
operator std::error_code&() { return ec; }
Expand Down Expand Up @@ -117,10 +124,7 @@ namespace vcpkg
inline bool is_regular_file(FileType s) { return s == FileType::regular; }
inline bool is_directory(FileType s) { return s == FileType::directory; }
inline bool exists(FileType s) { return s != FileType::not_found && s != FileType::none; }
}

namespace vcpkg
{
struct FilePointer
{
protected:
Expand Down
43 changes: 41 additions & 2 deletions include/vcpkg/base/messages.h
Original file line number Diff line number Diff line change
Expand Up @@ -462,11 +462,19 @@ namespace vcpkg
"",
"The first argument to '{command_line}' must be 'artifact' or 'port'.");
DECLARE_MESSAGE(AddingCompletionEntry, (msg::path), "", "Adding vcpkg completion entry to {path}.");
DECLARE_MESSAGE(AdditionalPackagesToRemove,
(),
"",
"Additional packages (*) need to be removed to complete this operation.");
DECLARE_MESSAGE(AddPortRequiresManifest,
(msg::command_line),
"",
"'{command_line}' requires an active manifest file.");
DECLARE_MESSAGE(AddPortSucceeded, (), "", "Succeeded in adding ports to vcpkg.json file.");
DECLARE_MESSAGE(AddRecurseOption,
(),
"",
"If you are sure you want to remove them, run the command with the --recurse option.");
DECLARE_MESSAGE(AddTripletExpressionNotAllowed,
(msg::package_name, msg::triplet),
"",
Expand Down Expand Up @@ -866,6 +874,7 @@ namespace vcpkg
"expected '{expected}' here");
DECLARE_MESSAGE(ExpectedFailOrSkip, (), "", "expected 'fail', 'skip', or 'pass' here");
DECLARE_MESSAGE(ExpectedPortName, (), "", "expected a port name here");
DECLARE_MESSAGE(ExpectedStatusField, (), "", "Expected 'status' field in status paragraph");
DECLARE_MESSAGE(ExpectedTripletName, (), "", "expected a triplet name here");
DECLARE_MESSAGE(ExpectedValueForOption, (msg::option), "", "expected value after --{option}.");
DECLARE_MESSAGE(ExportingPackage, (msg::package_name), "", "Exporting {package_name}...");
Expand All @@ -879,8 +888,13 @@ namespace vcpkg
DECLARE_MESSAGE(FailedToLoadInstalledManifest,
(msg::spec),
"",
"The control or manifest file for {spec} could not be loaded due to the following error. Please "
"remove {spec} and re-attempt.");
"The control or mnaifest file for {spec} could not be loaded due to the following error. Please "
"remove {spec} and try again.");
DECLARE_MESSAGE(FailedToLoadPort,
(msg::package_name, msg::path),
"",
"Failed to load port {package_name} from {path}");
DECLARE_MESSAGE(FailedToLoadPortFrom, (msg::path), "", "Failed to load port from {path}");
DECLARE_MESSAGE(FailedToLocateSpec, (msg::spec), "", "Failed to locate spec in graph: {spec}");
DECLARE_MESSAGE(FailedToObtainDependencyVersion, (), "", "Cannot find desired dependency version.");
DECLARE_MESSAGE(FailedToObtainLocalPortGitSha, (), "", "Failed to obtain git SHAs for local ports.");
Expand Down Expand Up @@ -916,6 +930,7 @@ namespace vcpkg
"One or more {vendor} credential providers failed to authenticate. See '{url}' for more details "
"on how to provide credentials.");
DECLARE_MESSAGE(FeedbackAppreciated, (), "", "Thank you for your feedback!");
DECLARE_MESSAGE(FileNotFound, (msg::path), "", "{path}: file not found");
DECLARE_MESSAGE(FishCompletion, (msg::path), "", "vcpkg fish completion is already added at \"{path}\".");
DECLARE_MESSAGE(FollowingPackagesMissingControl,
(),
Expand Down Expand Up @@ -1127,6 +1142,10 @@ namespace vcpkg
(msg::system_name, msg::value),
"'{value}' is the linkage type vcpkg would did not understand. (Correct values would be static ofr dynamic)",
"Invalid {system_name} linkage type: [{value}]");
DECLARE_MESSAGE(InvalidOptionForRemove,
(),
"'remove' is a command that should not be changed.",
"'remove' accepts either libraries or '--outdated'");
DECLARE_MESSAGE(InvalidTriplet, (msg::triplet), "", "Invalid triplet: {triplet}");
DECLARE_MESSAGE(IrregularFile, (msg::path), "", "path was not a regular file: {path}");
DECLARE_MESSAGE(JsonErrorMustBeAnObject, (msg::path), "", "Expected \"{path}\" to be an object.");
Expand Down Expand Up @@ -1237,6 +1256,10 @@ namespace vcpkg
"Found both a manifest and CONTROL files in port \"{path}\"; please rename one or the other");
DECLARE_MESSAGE(ManifestFormatCompleted, (), "", "Succeeded in formatting the manifest files.");
DECLARE_MESSAGE(MismatchedFiles, (), "", "file to store does not match hash");
DECLARE_MESSAGE(MismatchedNames,
(msg::package_name, msg::actual),
"{actual} is the port name found",
"names did not match: '{package_name}' != '{actual}'");
DECLARE_MESSAGE(Missing7zHeader, (), "", "Unable to find 7z header.");
DECLARE_MESSAGE(MissingArgFormatManifest,
(),
Expand Down Expand Up @@ -1293,6 +1316,7 @@ namespace vcpkg
"The name 'search' is the name of a command that is not localized.",
"No packages are installed. Did you mean `search`?");
DECLARE_MESSAGE(NoLocalizationForMessages, (), "", "No localized messages for the following: ");
DECLARE_MESSAGE(NoOutdatedPackages, (), "", "There are no outdated packages.");
DECLARE_MESSAGE(NoRegistryForPort, (msg::package_name), "", "no registry configured for port {package_name}");
DECLARE_MESSAGE(NugetPackageFileSucceededButCreationFailed,
(msg::path),
Expand All @@ -1305,7 +1329,9 @@ namespace vcpkg
"{value} is a command line option.",
"--{value} requires --{option}");
DECLARE_MESSAGE(OriginalBinParagraphHeader, (), "", "\nOriginal Binary Paragraph");
DECLARE_MESSAGE(OverlayPatchDir, (msg::path), "", "Overlay path \"{path}\" must exist and must be a directory.");
DECLARE_MESSAGE(OverwritingFile, (msg::path), "", "File {path} was already present and will be overwritten");
DECLARE_MESSAGE(PackageAlreadyRemoved, (msg::spec), "", "unable to remove package {spec}: already removed");
DECLARE_MESSAGE(PackageFailedtWhileExtracting,
(msg::value, msg::path),
"'{value}' is either a tool name or a package name.",
Expand Down Expand Up @@ -1373,11 +1399,23 @@ namespace vcpkg
(msg::tool_name, msg::exit_code),
"The program's console output is appended after this.",
"{tool_name} failed with exit code: ({exit_code}).");
DECLARE_MESSAGE(MutuallyExclusiveOption,
(msg::value, msg::option),
"{value} is a second {option} switch",
"--{value} can not be used with --{option}.");
DECLARE_MESSAGE(PushingVendorFailed,
(msg::vendor, msg::path),
"",
"Pushing {vendor} to \"{path}\" failed. Use --debug for more information.");
DECLARE_MESSAGE(RegistryCreated, (msg::path), "", "Successfully created registry at {path}");
DECLARE_MESSAGE(RemoveDependencies,
(),
"",
"To remove dependencies in manifest mode, edit your manifest (vcpkg.json) and run 'install'.");
DECLARE_MESSAGE(RemovePackageConflict,
(msg::spec),
"",
"Another installed package matches the name of an unmatched request. Did you mean {spec}?");
DECLARE_MESSAGE(ReplaceSecretsError,
(msg::error_msg),
"",
Expand Down Expand Up @@ -1677,4 +1715,5 @@ namespace vcpkg
DECLARE_MESSAGE(WhileLookingForSpec, (msg::spec), "", "while looking for {spec}:");
DECLARE_MESSAGE(WindowsOnlyCommand, (), "", "This command only supports Windows.");
DECLARE_MESSAGE(WroteNuGetPkgConfInfo, (msg::path), "", "Wrote NuGet package config information to {path}.");
DECLARE_MESSAGE(FileSystemOperationFailed, (), "", "Filesystem operation failed:");
}
17 changes: 16 additions & 1 deletion locales/messages.en.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
"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.",
"AddRecurseOption": "If you are sure you want to remove them, run the command with the --recurse option.",
"AddTripletExpressionNotAllowed": "triplet expressions are not allowed here. You may want to change `{package_name}:{triplet}` to `{package_name}` instead.",
"AddVersionAddedVersionToFile": "added version {version} to {path}",
"AddVersionCommitChangesReminder": "Did you remember to commit your changes?",
Expand Down Expand Up @@ -32,6 +33,7 @@
"AddVersionVersionAlreadyInFile": "version {version} is already in {path}",
"AddVersionVersionIs": "version: {version}",
"AddingCompletionEntry": "Adding vcpkg completion entry to {path}.",
"AdditionalPackagesToRemove": "Additional packages (*) need to be removed to complete this operation.",
"AllFormatArgsRawArgument": "format string \"{value}\" contains a raw format argument",
"AllFormatArgsUnbalancedBraces": "unbalanced brace in format string \"{value}\"",
"AllPackagesAreUpdated": "All installed packages are up-to-date with the local portfile.",
Expand Down Expand Up @@ -145,14 +147,17 @@
"ExpectedCharacterHere": "expected '{expected}' here",
"ExpectedFailOrSkip": "expected 'fail', 'skip', or 'pass' here",
"ExpectedPortName": "expected a port name here",
"ExpectedStatusField": "Expected 'status' field in status paragraph",
"ExpectedTripletName": "expected a triplet name here",
"ExpectedValueForOption": "expected value after --{option}.",
"ExportingPackage": "Exporting {package_name}...",
"ExtendedDocumentationAtUrl": "Extended documentation available at '{url}'.",
"FailedToExtract": "Failed to extract \"{path}\":",
"FailedToFindPortFeature": "Could not find {feature} in {spec}.",
"FailedToFormatMissingFile": "No files to format.\nPlease pass either --all, or the explicit files to format or convert.",
"FailedToLoadInstalledManifest": "The control or manifest file for {spec} could not be loaded due to the following error. Please remove {spec} and re-attempt.",
"FailedToLoadInstalledManifest": "The control or mnaifest file for {spec} could not be loaded due to the following error. Please remove {spec} and try again.",
"FailedToLoadPort": "Failed to load port {package_name} from {path}",
"FailedToLoadPortFrom": "Failed to load port from {path}",
"FailedToLocateSpec": "Failed to locate spec in graph: {spec}",
"FailedToObtainDependencyVersion": "Cannot find desired dependency version.",
"FailedToObtainLocalPortGitSha": "Failed to obtain git SHAs for local ports.",
Expand All @@ -172,6 +177,8 @@
"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!",
"FileNotFound": "{path}: file not found",
"FileSystemOperationFailed": "Filesystem operation failed:",
"FishCompletion": "vcpkg fish completion is already added at \"{path}\".",
"FollowingPackagesMissingControl": "The following packages do not have a valid CONTROL or vcpkg.json:",
"FollowingPackagesNotInstalled": "The following packages are not installed:",
Expand Down Expand Up @@ -257,6 +264,7 @@
"InvalidFilename": "Filename cannot contain invalid chars {value}, but was {path}",
"InvalidFormatString": "invalid format string: {actual}",
"InvalidLinkage": "Invalid {system_name} linkage type: [{value}]",
"InvalidOptionForRemove": "'remove' accepts either libraries or '--outdated'",
"InvalidTriplet": "Invalid triplet: {triplet}",
"IrregularFile": "path was not a regular file: {path}",
"JsonErrorMustBeAnObject": "Expected \"{path}\" to be an object.",
Expand Down Expand Up @@ -288,6 +296,7 @@
"ManifestConflict": "Found both a manifest and CONTROL files in port \"{path}\"; please rename one or the other",
"ManifestFormatCompleted": "Succeeded in formatting the manifest files.",
"MismatchedFiles": "file to store does not match hash",
"MismatchedNames": "names did not match: '{package_name}' != '{actual}'",
"Missing7zHeader": "Unable to find 7z header.",
"MissingArgFormatManifest": "format-manifest was passed --convert-control without '--all'.\nThis doesn't do anything: control files passed explicitly are converted automatically.",
"MissingDependency": "Package {spec} is installed, but dependency {package_name} is not.",
Expand All @@ -298,6 +307,7 @@
"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:",
"MultiArch": "Multi-Arch must be 'same' but was {option}",
"MutuallyExclusiveOption": "--{value} can not be used with --{option}.",
"NavigateToNPS": "Please navigate to {url} in your preferred browser.",
"NewConfigurationAlreadyExists": "Creating a manifest would overwrite a vcpkg-configuration.json at {path}.",
"NewManifestAlreadyExists": "A manifest is already present at {path}.",
Expand All @@ -309,14 +319,17 @@
"NoCachedPackages": "No packages are cached.",
"NoInstalledPackages": "No packages are installed. Did you mean `search`?",
"NoLocalizationForMessages": "No localized messages for the following: ",
"NoOutdatedPackages": "There are no outdated packages.",
"NoRegistryForPort": "no registry configured for port {package_name}",
"NoteMessage": "note: ",
"NugetPackageFileSucceededButCreationFailed": "NuGet package creation succeeded, but no .nupkg was produced. Expected: \"{path}\"",
"OptionMustBeInteger": "Value of --{option} must be an integer.",
"OptionRequired": "--{option} option is required.",
"OptionRequiresOption": "--{value} requires --{option}",
"OriginalBinParagraphHeader": "\nOriginal Binary Paragraph",
"OverlayPatchDir": "Overlay path \"{path}\" must exist and must be a directory.",
"OverwritingFile": "File {path} was already present and will be overwritten",
"PackageAlreadyRemoved": "unable to remove package {spec}: already removed",
"PackageFailedtWhileExtracting": "'{value}' failed while extracting {path}.",
"PackageRootDir": "(Experimental) Specify the packages root directory.",
"PackagesToInstall": "The following packages will be built and installed:",
Expand Down Expand Up @@ -346,6 +359,8 @@
"ProgramReturnedNonzeroExitCode": "{tool_name} failed with exit code: ({exit_code}).",
"PushingVendorFailed": "Pushing {vendor} to \"{path}\" failed. Use --debug for more information.",
"RegistryCreated": "Successfully created registry at {path}",
"RemoveDependencies": "To remove dependencies in manifest mode, edit your manifest (vcpkg.json) and run 'install'.",
"RemovePackageConflict": "Another installed package matches the name of an unmatched request. Did you mean {spec}?",
"RemovingPackage": "Removing {action_index}/{count} {spec}",
"ReplaceSecretsError": "Replace secretes produced the following error: '{error_msg}'",
"RestoredPackage": "Restored package from \"{path}\"",
Expand Down
Loading