virt-host-validate: Improve translatability of messages printed by 'virHostMsgCheck()'

Move the word 'Checking' into the appropriate formatting strings and
mark all outstanding ones for translation.

Resolves: https://gitlab.com/libvirt/libvirt/-/issues/637
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
This commit is contained in:
Peter Krempa 2024-05-20 14:56:12 +02:00
parent afbd1bb89e
commit cb78302a51
4 changed files with 13 additions and 13 deletions

View File

@ -28,7 +28,7 @@
#include "virt-host-validate-common.h" #include "virt-host-validate-common.h"
#define MODULE_STATUS(mod, err_msg, err_code) \ #define MODULE_STATUS(mod, err_msg, err_code) \
virHostMsgCheck("BHYVE", _("for %1$s module"), #mod); \ virHostMsgCheck("BHYVE", _("Checking for %1$s module"), #mod); \
if (mod ## _loaded) { \ if (mod ## _loaded) { \
virHostMsgPass(); \ virHostMsgPass(); \
} else { \ } else { \

View File

@ -57,7 +57,7 @@ int virHostValidateCh(void)
} }
if (hasVirtFlag) { if (hasVirtFlag) {
virHostMsgCheck("CH", "%s", _("for hardware virtualization")); virHostMsgCheck("CH", "%s", _("Checking for hardware virtualization"));
if (hasHwVirt) { if (hasHwVirt) {
virHostMsgPass(); virHostMsgPass();
} else { } else {

View File

@ -66,7 +66,7 @@ void virHostMsgCheck(const char *prefix,
msg = g_strdup_vprintf(format, args); msg = g_strdup_vprintf(format, args);
va_end(args); va_end(args);
fprintf(stdout, _("%1$6s: Checking %2$-60s: "), prefix, msg); fprintf(stdout, "%1$6s: %2$-69s: ", prefix, msg);
} }
static bool virHostMsgWantEscape(void) static bool virHostMsgWantEscape(void)
@ -137,7 +137,7 @@ int virHostValidateDeviceExists(const char *hvname,
virHostValidateLevel level, virHostValidateLevel level,
const char *hint) const char *hint)
{ {
virHostMsgCheck(hvname, "if device %s exists", dev_name); virHostMsgCheck(hvname, _("Checking if device '%1$s' exists"), dev_name);
if (access(dev_name, F_OK) < 0) { if (access(dev_name, F_OK) < 0) {
virHostMsgFail(level, "%s", hint); virHostMsgFail(level, "%s", hint);
@ -154,7 +154,7 @@ int virHostValidateDeviceAccessible(const char *hvname,
virHostValidateLevel level, virHostValidateLevel level,
const char *hint) const char *hint)
{ {
virHostMsgCheck(hvname, "if device %s is accessible", dev_name); virHostMsgCheck(hvname, _("Checking if device '%1$s' is accessible"), dev_name);
if (access(dev_name, R_OK|W_OK) < 0) { if (access(dev_name, R_OK|W_OK) < 0) {
virHostMsgFail(level, "%s", hint); virHostMsgFail(level, "%s", hint);
@ -173,7 +173,7 @@ int virHostValidateNamespace(const char *hvname,
{ {
char nspath[100]; char nspath[100];
virHostMsgCheck(hvname, "for namespace %s", ns_name); virHostMsgCheck(hvname, _("Checking for namespace '%1$s'"), ns_name);
g_snprintf(nspath, sizeof(nspath), "/proc/self/ns/%s", ns_name); g_snprintf(nspath, sizeof(nspath), "/proc/self/ns/%s", ns_name);
@ -256,7 +256,7 @@ int virHostValidateLinuxKernel(const char *hvname,
uname(&uts); uname(&uts);
virHostMsgCheck(hvname, _("for Linux >= %1$d.%2$d.%3$d"), virHostMsgCheck(hvname, _("Checking for Linux >= %1$d.%2$d.%3$d"),
((version >> 16) & 0xff), ((version >> 16) & 0xff),
((version >> 8) & 0xff), ((version >> 8) & 0xff),
(version & 0xff)); (version & 0xff));
@ -302,7 +302,7 @@ int virHostValidateCGroupControllers(const char *hvname,
if (!(controllers & flag)) if (!(controllers & flag))
continue; continue;
virHostMsgCheck(hvname, "for cgroup '%s' controller support", cg_name); virHostMsgCheck(hvname, _("Checking for cgroup '%1$s' controller support"), cg_name);
if (!virCgroupHasController(group, i)) { if (!virCgroupHasController(group, i)) {
ret = VIR_HOST_VALIDATE_FAILURE(level); ret = VIR_HOST_VALIDATE_FAILURE(level);
@ -337,7 +337,7 @@ int virHostValidateIOMMU(const char *hvname,
struct dirent *dent; struct dirent *dent;
int rc; int rc;
virHostMsgCheck(hvname, "%s", _("for device assignment IOMMU support")); virHostMsgCheck(hvname, "%s", _("Checking for device assignment IOMMU support"));
flags = virHostValidateGetCPUFlags(); flags = virHostValidateGetCPUFlags();
@ -423,7 +423,7 @@ int virHostValidateIOMMU(const char *hvname,
if (!S_ISDIR(sb.st_mode)) if (!S_ISDIR(sb.st_mode))
return 0; return 0;
virHostMsgCheck(hvname, "%s", _("if IOMMU is enabled by kernel")); virHostMsgCheck(hvname, "%s", _("Checking if IOMMU is enabled by kernel"));
if (sb.st_nlink <= 2) { if (sb.st_nlink <= 2) {
if (bootarg) if (bootarg)
virHostMsgFail(level, virHostMsgFail(level,
@ -483,7 +483,7 @@ int virHostValidateSecureGuests(const char *hvname,
else if (flags && virBitmapIsBitSet(flags, VIR_HOST_VALIDATE_CPU_FLAG_SEV)) else if (flags && virBitmapIsBitSet(flags, VIR_HOST_VALIDATE_CPU_FLAG_SEV))
hasAMDSev = true; hasAMDSev = true;
virHostMsgCheck(hvname, "%s", _("for secure guest support")); virHostMsgCheck(hvname, "%s", _("Checking for secure guest support"));
if (ARCH_IS_S390(arch)) { if (ARCH_IS_S390(arch)) {
if (hasFac158) { if (hasFac158) {
if (!virFileIsDir("/sys/firmware/uv")) { if (!virFileIsDir("/sys/firmware/uv")) {

View File

@ -64,7 +64,7 @@ int virHostValidateQEMU(void)
} }
if (hasVirtFlag) { if (hasVirtFlag) {
virHostMsgCheck("QEMU", "%s", _("for hardware virtualization")); virHostMsgCheck("QEMU", "%s", _("Checking for hardware virtualization"));
if (hasHwVirt) { if (hasHwVirt) {
virHostMsgPass(); virHostMsgPass();
} else { } else {
@ -86,7 +86,7 @@ int virHostValidateQEMU(void)
} }
if (arch == VIR_ARCH_PPC64 || arch == VIR_ARCH_PPC64LE) { if (arch == VIR_ARCH_PPC64 || arch == VIR_ARCH_PPC64LE) {
virHostMsgCheck("QEMU", "%s", _("for PowerPC KVM module loaded")); virHostMsgCheck("QEMU", "%s", _("Checking for PowerPC KVM module loaded"));
if (!virHostKernelModuleIsLoaded("kvm_hv")) if (!virHostKernelModuleIsLoaded("kvm_hv"))
virHostMsgFail(VIR_HOST_VALIDATE_WARN, virHostMsgFail(VIR_HOST_VALIDATE_WARN,