diff options
Diffstat (limited to 'ui/filesave.go')
-rw-r--r-- | ui/filesave.go | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/ui/filesave.go b/ui/filesave.go index 4b5c2947..3a54f015 100644 --- a/ui/filesave.go +++ b/ui/filesave.go @@ -1,15 +1,16 @@ /* SPDX-License-Identifier: MIT * - * Copyright (C) 2019 WireGuard LLC. All Rights Reserved. + * Copyright (C) 2019-2022 WireGuard LLC. All Rights Reserved. */ package ui import ( - "fmt" "os" "github.com/lxn/walk" + + "golang.zx2c4.com/wireguard/windows/l18n" ) func writeFileWithOverwriteHandling(owner walk.Form, filePath string, write func(file *os.File) error) bool { @@ -18,15 +19,15 @@ func writeFileWithOverwriteHandling(owner walk.Form, filePath string, write func return false } - showErrorCustom(owner, "Writing file failed", err.Error()) + showErrorCustom(owner, l18n.Sprintf("Writing file failed"), err.Error()) return true } - file, err := os.OpenFile(filePath, os.O_CREATE|os.O_WRONLY|os.O_EXCL, 0600) + file, err := os.OpenFile(filePath, os.O_CREATE|os.O_WRONLY|os.O_EXCL, 0o600) if err != nil { if os.IsExist(err) { - if walk.DlgCmdNo == walk.MsgBox(owner, "Writing file failed", fmt.Sprintf(`File ā%sā already exists. + if walk.DlgCmdNo == walk.MsgBox(owner, l18n.Sprintf("Writing file failed"), l18n.Sprintf(`File ā%sā already exists. Do you want to overwrite it?`, filePath), walk.MsgBoxYesNo|walk.MsgBoxDefButton2|walk.MsgBoxIconWarning) { return false |