Skip to content

Commit 63235d5

Browse files
author
Steve Lee (POWERSHELL HE/HIM) (from Dev Box)
committed
make strings localizable
1 parent 2c8856a commit 63235d5

File tree

2 files changed

+13
-5
lines changed

2 files changed

+13
-5
lines changed

dsc_lib/locales/en-us.toml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -589,6 +589,13 @@ invalidRequiredVersion = "Invalid required version '%{version}' for resource '%{
589589
[progress]
590590
failedToSerialize = "Failed to serialize progress JSON: %{json}"
591591

592+
[security.authenticode]
593+
fileNotSigned = "File '%{file}' is not signed"
594+
signatureExplicitlyDistrusted = "The signature for file '%{file}' is explicitly distrusted"
595+
signatureNotTrusted = "The signature for file '%{file}' is not trusted"
596+
signatureDoesNotMeetSecuritySettings = "The signature for file '%{file}' does not meet the security settings"
597+
signatureCouldNotBeVerified = "The signature for file '%{file}' could not be verified. HRESULT: 0x%{hresult}"
598+
592599
[util]
593600
foundSetting = "Found setting '%{name}' in %{path}"
594601
notFoundSetting = "Setting '%{name}' not found in %{path}"

dsc_lib/src/security/authenticode.rs

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33

44
use crate::dscerror::DscError;
55
use crate::security::{add_file_as_checked, is_file_checked};
6+
use rust_i18n::t;
67
use std::{
78
ffi::OsStr,
89
mem::size_of,
@@ -102,11 +103,11 @@ pub fn check_authenticode(file_path: &Path) -> Result<(), DscError> {
102103
Ok(())
103104
} else {
104105
match hresult {
105-
TRUST_E_NOSIGNATURE => Err(DscError::AuthenticodeError(format!("The file '{}' is not signed.", file_path.display()))),
106-
TRUST_E_EXPLICIT_DISTRUST => Err(DscError::AuthenticodeError(format!("The signature of the file '{}' is explicitly distrusted.", file_path.display()))),
107-
TRUST_E_SUBJECT_NOT_TRUSTED => Err(DscError::AuthenticodeError(format!("The signature of the file '{}' is not trusted.", file_path.display()))),
108-
CRYPT_E_SECURITY_SETTINGS => Err(DscError::AuthenticodeError(format!("The signature of the file '{}' does not meet the security settings.", file_path.display()))),
109-
_ => Err(DscError::AuthenticodeError(format!("The signature of the file '{}' could not be verified. HRESULT: 0x{:X}", file_path.display(), hresult.0))),
106+
TRUST_E_NOSIGNATURE => Err(DscError::AuthenticodeError(t!("security.authenticode.fileNotSigned", file = file_path.display()).to_string())),
107+
TRUST_E_EXPLICIT_DISTRUST => Err(DscError::AuthenticodeError(t!("security.authenticode.signatureExplicitlyDistrusted", file = file_path.display()).to_string())),
108+
TRUST_E_SUBJECT_NOT_TRUSTED => Err(DscError::AuthenticodeError(t!("security.authenticode.signatureNotTrusted", file = file_path.display()).to_string())),
109+
CRYPT_E_SECURITY_SETTINGS => Err(DscError::AuthenticodeError(t!("security.authenticode.signatureDoesNotMeetSecuritySettings", file = file_path.display()).to_string())),
110+
_ => Err(DscError::AuthenticodeError(t!("security.authenticode.signatureCouldNotBeVerified", file = file_path.display(), hresult = hresult.0).to_string())),
110111
}
111112
}
112113
}

0 commit comments

Comments
 (0)