From fc2bc1806cd655ad3a825a289cb28bce5a80fb8d Mon Sep 17 00:00:00 2001 From: Reagan Lopez Date: Wed, 22 May 2019 12:39:34 -0700 Subject: [PATCH] Remove hardcoding filename in localization files Signed-off-by: Reagan Lopez --- locale/en_US/LC_MESSAGES/clr-installer.po | 5 +++-- locale/es_MX/LC_MESSAGES/clr-installer.po | 5 +++-- locale/zh_CN/LC_MESSAGES/clr-installer.po | 5 +++-- syscheck/syscheck.go | 7 ++++--- 4 files changed, 13 insertions(+), 9 deletions(-) diff --git a/locale/en_US/LC_MESSAGES/clr-installer.po b/locale/en_US/LC_MESSAGES/clr-installer.po index 73006a3..3f4050a 100644 --- a/locale/en_US/LC_MESSAGES/clr-installer.po +++ b/locale/en_US/LC_MESSAGES/clr-installer.po @@ -490,8 +490,9 @@ msgstr "System failed to pass pre-install checks." msgid "System Check Failed" msgstr "System Check Failed" -msgid "Unable to read /proc/cpuinfo" -msgstr "Unable to read /proc/cpuinfo" +#, c-format +msgid "Unable to read %s" +msgstr "Unable to read %s" msgid "Missing CPU feature: " msgstr "Missing CPU feature: " diff --git a/locale/es_MX/LC_MESSAGES/clr-installer.po b/locale/es_MX/LC_MESSAGES/clr-installer.po index 883c8b2..0cfd422 100644 --- a/locale/es_MX/LC_MESSAGES/clr-installer.po +++ b/locale/es_MX/LC_MESSAGES/clr-installer.po @@ -490,8 +490,9 @@ msgstr "El sistema no pasó las comprobaciones previas a la instalación." msgid "System Check Failed" msgstr "Comprobación del sistema fallida" -msgid "Unable to read /proc/cpuinfo" -msgstr "No puede leer /proc/cpuinfo" +#, c-format +msgid "Unable to read %s" +msgstr "No puede leer %s" msgid "Missing CPU feature: " msgstr "Característica de la CPU que falta: " diff --git a/locale/zh_CN/LC_MESSAGES/clr-installer.po b/locale/zh_CN/LC_MESSAGES/clr-installer.po index 8b0d59b..7e302ae 100644 --- a/locale/zh_CN/LC_MESSAGES/clr-installer.po +++ b/locale/zh_CN/LC_MESSAGES/clr-installer.po @@ -490,8 +490,9 @@ msgstr "系统无法通过安装前检查。" msgid "System Check Failed" msgstr "系统检查失败" -msgid "Unable to read /proc/cpuinfo" -msgstr "无法读取 /proc/cpuinfo" +#, c-format +msgid "Unable to read %s" +msgstr "无法读取 %s" msgid "Missing CPU feature: " msgstr "缺少CPU功能: " diff --git a/syscheck/syscheck.go b/syscheck/syscheck.go index 1c4643d..9c6c8d5 100644 --- a/syscheck/syscheck.go +++ b/syscheck/syscheck.go @@ -16,10 +16,11 @@ import ( ) func getCPUFeature(feature string) error { - cpuInfo, err := ioutil.ReadFile("/proc/cpuinfo") + fName := "/proc/cpuinfo" + cpuInfo, err := ioutil.ReadFile(fName) if err != nil { - log.Error("Unable to read /proc/cpuinfo") - return errors.New(utils.Locale.Get("Unable to read /proc/cpuinfo")) + log.Error("Unable to read %s", fName) + return errors.New(utils.Locale.Get("Unable to read %s", fName)) } if strings.Contains(string(cpuInfo), feature) { return nil