diff options
| author | Burt P <pburt0@gmail.com> | 2017-07-12 21:34:18 -0500 | 
|---|---|---|
| committer | Leandro Pereira <leandro@hardinfo.org> | 2017-07-12 19:39:13 -0700 | 
| commit | 6351b0c43b07b65ca1c94c2f16a1ef912b5b9b96 (patch) | |
| tree | f307208a2d3eedf8befe8663740580fae0b0593e | |
| parent | 07279edcb3b9fbd03bfc2b2648734bb95ee6c622 (diff) | |
Make bits of entropy string translatable
Signed-off-by: Burt P <pburt0@gmail.com>
| -rw-r--r-- | modules/computer/os.c | 15 | 
1 files changed, 10 insertions, 5 deletions
diff --git a/modules/computer/os.c b/modules/computer/os.c index b6975854..fa9bb476 100644 --- a/modules/computer/os.c +++ b/modules/computer/os.c @@ -158,12 +158,17 @@ detect_desktop_environment(OperatingSystem * os)  gchar *  computer_get_entropy_avail(void)  { +    gchar tab_entropy_fstr[][32] = { +      N_(/*/bits of entropy for rng (0)*/              "(None or not available)"), +      N_(/*/bits of entropy for rng (low/poor value)*/  "%d bits (low)"), +      N_(/*/bits of entropy for rng (medium value)*/    "%d bits (medium)"), +      N_(/*/bits of entropy for rng (high/good value)*/ "%d bits (healthy)") +    };      gint bits = h_sysfs_read_int("/proc/sys/kernel/random", "entropy_avail"); -    if (bits < 200) -        return g_strdup_printf("%d bits (low)", bits); -    if (bits < 3000) -        return g_strdup_printf("%d bits (medium)", bits); -    return g_strdup_printf("%d bits (healthy)", bits); +    if (bits > 3000) return g_strdup_printf(_(tab_entropy_fstr[3]), bits); +    if (bits > 200)  return g_strdup_printf(_(tab_entropy_fstr[2]), bits); +    if (bits > 1)    return g_strdup_printf(_(tab_entropy_fstr[1]), bits); +    return g_strdup_printf(_(tab_entropy_fstr[0]), bits);  }  OperatingSystem *  | 
