Skip to content

Commit

Permalink
syscheck: Localize syscheck and dialog
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
evil-brain authored and mdhorn committed May 16, 2019
1 parent dbeeda5 commit cdc969c
Show file tree
Hide file tree
Showing 5 changed files with 51 additions and 5 deletions.
4 changes: 2 additions & 2 deletions gui/window.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
15 changes: 15 additions & 0 deletions locale/en_US/LC_MESSAGES/clr-installer.po
Original file line number Diff line number Diff line change
Expand Up @@ -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"
15 changes: 15 additions & 0 deletions locale/es_MX/LC_MESSAGES/clr-installer.po
Original file line number Diff line number Diff line change
Expand Up @@ -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"
15 changes: 15 additions & 0 deletions locale/zh_CN/LC_MESSAGES/clr-installer.po
Original file line number Diff line number Diff line change
Expand Up @@ -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固件"
7 changes: 4 additions & 3 deletions syscheck/syscheck.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit cdc969c

Please sign in to comment.