aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBurt P <pburt0@gmail.com>2017-08-15 14:29:34 -0500
committerLeandro A. F. Pereira <leandro@hardinfo.org>2017-08-27 08:21:05 -0700
commit498d86fac0bd419bd0695f5640cf4d96dc5c575a (patch)
treeaf461761d555521f3c90734899ed14ea5a54b0b2
parentd9d6a0d20d424124ff961d6391f4fbc3a5fdf334 (diff)
DMI: make labels translatable
Signed-off-by: Burt P <pburt0@gmail.com>
-rw-r--r--modules/devices/dmi.c35
1 files changed, 18 insertions, 17 deletions
diff --git a/modules/devices/dmi.c b/modules/devices/dmi.c
index d6cac717..78abe0fc 100644
--- a/modules/devices/dmi.c
+++ b/modules/devices/dmi.c
@@ -28,20 +28,21 @@ typedef struct _DMIInfo DMIInfo;
struct _DMIInfo {
const gchar *name;
const gchar *id_str;
+ int group;
};
DMIInfo dmi_info_table[] = {
- { "$BIOS", NULL },
- { "Date", "bios-release-date" },
- { "Vendor", "bios-vendor" },
- { "Version#0", "bios-version" },
- { "$Board", NULL },
- { "Name", "baseboard-product-name" },
- { "Vendor", "baseboard-manufacturer" },
- { "$Product", NULL },
- { "Name", "system-product-name" },
- { "Family", "system-product-family" },
- { "Version#1", "system-product-version" },
+ { N_("BIOS"), NULL, 1 },
+ { N_("Date"), "bios-release-date", 0 },
+ { N_("Vendor"), "bios-vendor", 0 },
+ { N_("Version#0"), "bios-version", 0 },
+ { N_("Board"), NULL, 1 },
+ { N_("Name"), "baseboard-product-name", 0 },
+ { N_("Vendor"), "baseboard-manufacturer", 0 },
+ { N_("Product"), NULL, 1 },
+ { N_("Name"), "system-product-name", 0 },
+ { N_("Family"), "system-product-family", 0 },
+ { N_("Version#1"), "system-product-version", 0 },
};
gchar *dmi_info = NULL;
@@ -125,9 +126,9 @@ gboolean dmi_get_info()
for (i = 0; i < G_N_ELEMENTS(dmi_info_table); i++) {
info = &dmi_info_table[i];
- if (*(info->name) == '$') {
- group = info->name + 1;
- dmi_info = h_strdup_cprintf("[%s]\n", dmi_info, group);
+ if (info->group) {
+ group = info->name;
+ dmi_info = h_strdup_cprintf("[%s]\n", dmi_info, _(info->name) );
} else if (group && info->id_str) {
value = dmi_get_str(info->id_str);
@@ -139,20 +140,20 @@ gboolean dmi_get_info()
const gchar *vendor = vendor_get_name(value);
dmi_info = h_strdup_cprintf("%s=%s (%s, %s)\n",
dmi_info,
- info->name,
+ _(info->name),
g_strstrip(value),
vendor, url);
} else {
dmi_info = h_strdup_cprintf("%s=%s\n",
dmi_info,
- info->name,
+ _(info->name),
g_strstrip(value));
}
dmi_succeeded = TRUE;
} else {
dmi_info = h_strdup_cprintf("%s=%s\n",
dmi_info,
- info->name,
+ _(info->name),
_("(Not available; Perhaps try running HardInfo as root.)") );
}
}