From cdc969c3b034403f19db69a81744598f7b5e6ce1 Mon Sep 17 00:00:00 2001 From: Brian J Lovin Date: Mon, 13 May 2019 20:33:26 +0000 Subject: [PATCH] syscheck: Localize syscheck and dialog Add localization strings to proper files and correct calls to insert these strings where necessary for syscheck and for the dialog when the user's system fails. Signed-off-by: Brian J Lovin --- gui/window.go | 4 ++-- locale/en_US/LC_MESSAGES/clr-installer.po | 15 +++++++++++++++ locale/es_MX/LC_MESSAGES/clr-installer.po | 15 +++++++++++++++ locale/zh_CN/LC_MESSAGES/clr-installer.po | 15 +++++++++++++++ syscheck/syscheck.go | 7 ++++--- 5 files changed, 51 insertions(+), 5 deletions(-) diff --git a/gui/window.go b/gui/window.go index df2ec98f..8048ce24 100644 --- a/gui/window.go +++ b/gui/window.go @@ -635,7 +635,7 @@ func (window *Window) launchMenuView() { icon.SetVAlign(gtk.ALIGN_START) contentBox.PackStart(icon, false, true, 0) - label, err := gtk.LabelNew("System failed to pass pre-install checks.\n\n" + retErr.Error()) + label, err := gtk.LabelNew(utils.Locale.Get("System failed to pass pre-install checks.") + "\n\n" + retErr.Error()) if err != nil { log.Warning("Error creating label") return @@ -644,7 +644,7 @@ func (window *Window) launchMenuView() { label.SetHAlign(gtk.ALIGN_END) contentBox.PackStart(label, false, true, 0) - dialog, err := common.CreateDialogOneButton(contentBox, "System Check Failed", utils.Locale.Get("EXIT"), "button-cancel") + dialog, err := common.CreateDialogOneButton(contentBox, utils.Locale.Get("System Check Failed"), utils.Locale.Get("EXIT"), "button-cancel") if err != nil { log.Warning("Error creating dialog") return diff --git a/locale/en_US/LC_MESSAGES/clr-installer.po b/locale/en_US/LC_MESSAGES/clr-installer.po index 65fc5e74..76ba6780 100644 --- a/locale/en_US/LC_MESSAGES/clr-installer.po +++ b/locale/en_US/LC_MESSAGES/clr-installer.po @@ -483,3 +483,18 @@ msgstr "Installation failed." msgid "Network is not working." msgstr "Network is not working." + +msgid "System failed to pass pre-install checks." +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" + +msgid "Missing CPU feature: " +msgstr "Missing CPU feature: " + +msgid "Failed to find EFI firmware" +msgstr "Failed to find EFI firmware" \ No newline at end of file diff --git a/locale/es_MX/LC_MESSAGES/clr-installer.po b/locale/es_MX/LC_MESSAGES/clr-installer.po index ce88944f..2856422d 100644 --- a/locale/es_MX/LC_MESSAGES/clr-installer.po +++ b/locale/es_MX/LC_MESSAGES/clr-installer.po @@ -483,3 +483,18 @@ msgstr "Instalación fallida." msgid "Network is not working." msgstr "La red no está funcionando." + +msgid "System failed to pass pre-install checks." +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" + +msgid "Missing CPU feature: " +msgstr "Característica de la CPU que falta: " + +msgid "Failed to find EFI firmware" +msgstr "Error al encontrar el firmware EFI" \ No newline at end of file diff --git a/locale/zh_CN/LC_MESSAGES/clr-installer.po b/locale/zh_CN/LC_MESSAGES/clr-installer.po index 824517d0..440fd660 100644 --- a/locale/zh_CN/LC_MESSAGES/clr-installer.po +++ b/locale/zh_CN/LC_MESSAGES/clr-installer.po @@ -483,3 +483,18 @@ msgstr "安装失败。" msgid "Network is not working." msgstr "网络无法正常工作。" + +msgid "System failed to pass pre-install checks." +msgstr "系统无法通过安装前检查。" + +msgid "System Check Failed" +msgstr "系统检查失败" + +msgid "Unable to read /proc/cpuinfo" +msgstr "无法读取 /proc/cpuinfo" + +msgid "Missing CPU feature: " +msgstr "缺少CPU功能: " + +msgid "Failed to find EFI firmware" +msgstr "无法找到EFI固件" \ No newline at end of file diff --git a/syscheck/syscheck.go b/syscheck/syscheck.go index 9c36a74d..1c4643de 100644 --- a/syscheck/syscheck.go +++ b/syscheck/syscheck.go @@ -12,24 +12,25 @@ import ( "strings" "github.com/clearlinux/clr-installer/log" + "github.com/clearlinux/clr-installer/utils" ) func getCPUFeature(feature string) error { cpuInfo, err := ioutil.ReadFile("/proc/cpuinfo") if err != nil { log.Error("Unable to read /proc/cpuinfo") - return errors.New("Unable to read /proc/cpuinfo") + return errors.New(utils.Locale.Get("Unable to read /proc/cpuinfo")) } if strings.Contains(string(cpuInfo), feature) { return nil } - return errors.New("Missing CPU feature: " + feature) + return errors.New(utils.Locale.Get("Missing CPU feature: ") + feature) } func getEFIExist() error { if _, err := os.Stat("/sys/firmware/efi"); os.IsNotExist(err) { - return errors.New("Failed to find EFI firmware") + return errors.New(utils.Locale.Get("Failed to find EFI firmware")) } return nil