mirror of
https://github.com/wavetermdev/wails.git
synced 2026-08-05 13:53:43 -07:00
Translations refactor
This commit is contained in:
@@ -10,7 +10,7 @@ import (
|
||||
)
|
||||
|
||||
func doInstallationStrategy(installStatus installationStatus, messages *windows.Messages) error {
|
||||
confirmed, err := webview2runtime.Confirm(messages.DownloadPageMsg+MinimumRuntimeVersion, messages.MissingRequirementsMsg)
|
||||
confirmed, err := webview2runtime.Confirm(messages.DownloadPageMsg+MinimumRuntimeVersion, messages.MissingRequirements)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
@@ -21,5 +21,5 @@ func doInstallationStrategy(installStatus installationStatus, messages *windows.
|
||||
}
|
||||
}
|
||||
|
||||
return fmt.Errorf(messages.FailedToInstallMsg)
|
||||
return fmt.Errorf(messages.FailedToInstall)
|
||||
}
|
||||
|
||||
@@ -10,24 +10,24 @@ import (
|
||||
)
|
||||
|
||||
func doInstallationStrategy(installStatus installationStatus, messages *windows.Messages) error {
|
||||
message := messages.InstallationRequiredMsg
|
||||
message := messages.InstallationRequired
|
||||
if installStatus == needsUpdating {
|
||||
message = messages.UpdateRequiredMsg
|
||||
message = messages.UpdateRequired
|
||||
}
|
||||
confirmed, err := webview2runtime.Confirm(message, messages.MissingRequirementsMsg)
|
||||
confirmed, err := webview2runtime.Confirm(message, messages.MissingRequirements)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if !confirmed {
|
||||
return fmt.Errorf(messages.Webview2NotInstalledMsg)
|
||||
return fmt.Errorf(messages.Webview2NotInstalled)
|
||||
}
|
||||
installedCorrectly, err := webview2runtime.InstallUsingBootstrapper()
|
||||
if err != nil {
|
||||
_ = webview2runtime.Error(err.Error(), messages.ErrorMsg)
|
||||
_ = webview2runtime.Error(err.Error(), messages.Error)
|
||||
return err
|
||||
}
|
||||
if !installedCorrectly {
|
||||
err = webview2runtime.Error(messages.FailedToInstallMsg, messages.ErrorMsg)
|
||||
err = webview2runtime.Error(messages.FailedToInstall, messages.Error)
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
|
||||
@@ -10,25 +10,25 @@ import (
|
||||
)
|
||||
|
||||
func doInstallationStrategy(installStatus installationStatus, messages *windows.Messages) error {
|
||||
message := messages.InstallationRequiredMsg
|
||||
message := messages.InstallationRequired
|
||||
if installStatus == needsUpdating {
|
||||
message = messages.UpdateRequiredMsg
|
||||
message = messages.UpdateRequired
|
||||
}
|
||||
message += messages.PressOKToInstallMsg
|
||||
confirmed, err := webview2runtime.Confirm(message, messages.MissingRequirementsMsg)
|
||||
message += messages.PressOKToInstall
|
||||
confirmed, err := webview2runtime.Confirm(message, messages.MissingRequirements)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if !confirmed {
|
||||
return fmt.Errorf(messages.Webview2NotInstalledMsg)
|
||||
return fmt.Errorf(messages.Webview2NotInstalled)
|
||||
}
|
||||
installedCorrectly, err := webview2runtime.InstallUsingEmbeddedBootstrapper()
|
||||
if err != nil {
|
||||
_ = webview2runtime.Error(err.Error(), messages.ErrorMsg)
|
||||
_ = webview2runtime.Error(err.Error(), messages.Error)
|
||||
return err
|
||||
}
|
||||
if !installedCorrectly {
|
||||
err = webview2runtime.Error(messages.FailedToInstallMsg, messages.ErrorMsg)
|
||||
err = webview2runtime.Error(messages.FailedToInstall, messages.Error)
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
|
||||
@@ -10,6 +10,6 @@ import (
|
||||
)
|
||||
|
||||
func doInstallationStrategy(installStatus installationStatus, messages *windows.Messages) error {
|
||||
_ = webview2runtime.Error(messages.ContactAdminMsg, messages.ErrorMsg)
|
||||
return fmt.Errorf(messages.Webview2NotInstalledMsg)
|
||||
_ = webview2runtime.Error(messages.ContactAdmin, messages.Error)
|
||||
return fmt.Errorf(messages.Webview2NotInstalled)
|
||||
}
|
||||
|
||||
@@ -3,15 +3,15 @@ package windows
|
||||
type Theme int
|
||||
|
||||
type Messages struct {
|
||||
InstallationRequiredMsg string
|
||||
UpdateRequiredMsg string
|
||||
MissingRequirementsMsg string
|
||||
Webview2NotInstalledMsg string
|
||||
ErrorMsg string
|
||||
FailedToInstallMsg string
|
||||
DownloadPageMsg string
|
||||
PressOKToInstallMsg string
|
||||
ContactAdminMsg string
|
||||
InstallationRequired string
|
||||
UpdateRequired string
|
||||
MissingRequirements string
|
||||
Webview2NotInstalled string
|
||||
Error string
|
||||
FailedToInstall string
|
||||
DownloadPage string
|
||||
PressOKToInstall string
|
||||
ContactAdmin string
|
||||
}
|
||||
|
||||
const (
|
||||
@@ -73,14 +73,14 @@ type Options struct {
|
||||
|
||||
func DefaultMessages() *Messages {
|
||||
return &Messages{
|
||||
InstallationRequiredMsg: "The WebView2 runtime is required. Press Ok to download and install. Note: The installer will download silently so please wait.",
|
||||
UpdateRequiredMsg: "The Webview2 runtime needs updating. Press Ok to download and install. Note: The installer will download silently so please wait.",
|
||||
MissingRequirementsMsg: "Missing Requirements",
|
||||
Webview2NotInstalledMsg: "webview2 runtime not installed",
|
||||
ErrorMsg: "Error",
|
||||
FailedToInstallMsg: "The runtime failed to install correctly. Please try again.",
|
||||
DownloadPageMsg: "This application requires the WebView2 runtime. Press OK to open the download page. Minimum version required: ",
|
||||
PressOKToInstallMsg: "Press Ok to install.",
|
||||
ContactAdminMsg: "The WebView2 runtime is required to run this application. Please contact your system administrator.",
|
||||
InstallationRequired: "The WebView2 runtime is required. Press Ok to download and install. Note: The installer will download silently so please wait.",
|
||||
UpdateRequired: "The Webview2 runtime needs updating. Press Ok to download and install. Note: The installer will download silently so please wait.",
|
||||
MissingRequirements: "Missing Requirements",
|
||||
Webview2NotInstalled: "webview2 runtime not installed",
|
||||
Error: "Error",
|
||||
FailedToInstall: "The runtime failed to install correctly. Please try again.",
|
||||
DownloadPage: "This application requires the WebView2 runtime. Press OK to open the download page. Minimum version required: ",
|
||||
PressOKToInstall: "Press Ok to install.",
|
||||
ContactAdmin: "The WebView2 runtime is required to run this application. Please contact your system administrator.",
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user