diff --git a/app/App.xaml.cs b/app/App.xaml.cs
index 0fe7266..1f53516 100644
--- a/app/App.xaml.cs
+++ b/app/App.xaml.cs
@@ -55,27 +55,30 @@ namespace ParsecVDisplay
return;
}
+ base.OnStartup(e);
+ LoadLanguages();
+
var status = ParsecVDD.QueryStatus();
if (status != Device.Status.OK)
{
if (status == Device.Status.RESTART_REQUIRED)
{
- MessageBox.Show("You must restart your PC to complete the driver setup.",
+ MessageBox.Show(GetTranslation("t_msg_must_restart_pc"),
NAME, MessageBoxButton.OK, MessageBoxImage.Warning);
}
else if (status == Device.Status.DISABLED)
{
- MessageBox.Show($"{ParsecVDD.ADAPTER} is disabled, please enable it.",
+ MessageBox.Show(GetTranslation("t_msg_driver_is_disabled", ParsecVDD.ADAPTER),
NAME, MessageBoxButton.OK, MessageBoxImage.Warning);
}
else if (status == Device.Status.NOT_INSTALLED)
{
- MessageBox.Show("Please install the driver first.",
+ MessageBox.Show(GetTranslation("t_msg_please_install_driver"),
NAME, MessageBoxButton.OK, MessageBoxImage.Warning);
}
else
{
- MessageBox.Show($"The driver is not OK, please check again. Current status: {status}.",
+ MessageBox.Show(GetTranslation("t_msg_driver_status_not_ok", status),
NAME, MessageBoxButton.OK, MessageBoxImage.Warning);
}
@@ -85,7 +88,7 @@ namespace ParsecVDisplay
if (ParsecVDD.Init() == false)
{
- MessageBox.Show("Failed to obtain the device handle, please check the driver installation again.",
+ MessageBox.Show(GetTranslation("t_msg_failed_to_obtain_handle"),
NAME, MessageBoxButton.OK, MessageBoxImage.Warning);
Shutdown();
@@ -100,9 +103,6 @@ namespace ParsecVDisplay
}
});
- base.OnStartup(e);
- LoadLanguages();
-
// Disable GPU to prevent flickering when adding display
RenderOptions.ProcessRenderMode = RenderMode.SoftwareOnly;
}
@@ -166,13 +166,16 @@ namespace ParsecVDisplay
}
}
- public static string GetTranslation(string key)
+ public static string GetTranslation(string key, params object[] args)
{
try
{
- var trans = Current.FindResource(key);
- if (trans != null && trans is string)
- return trans as string;
+ var translation = Current.FindResource(key);
+ if (translation != null && translation is string t)
+ {
+ t = t.Replace("\\n", "\n");
+ return string.Format(t, args);
+ }
}
catch
{
diff --git a/app/Components/CustomPage.xaml.cs b/app/Components/CustomPage.xaml.cs
index 4bab266..2fc3ecf 100644
--- a/app/Components/CustomPage.xaml.cs
+++ b/app/Components/CustomPage.xaml.cs
@@ -39,7 +39,7 @@ namespace ParsecVDisplay.Components
// Check negative values & limit 8K resolution
if (width < 0 || width > 7680 || height < 0 || height > 4320 || hz < 0)
{
- MessageBox.Show($"Found invalid value in slot {i / 3 + 1}.",
+ MessageBox.Show(App.GetTranslation("t_msg_custom_invalid_slot", i / 3 + 1),
App.NAME, MessageBoxButton.OK, MessageBoxImage.Warning);
return;
}
@@ -65,7 +65,7 @@ namespace ParsecVDisplay.Components
var args = $"-custom \"{Display.DumpModes(modes)}\" \"{parentGPU}\"";
if (Helper.RunAdminTask(args) == false)
{
- MessageBox.Show("Could not set custom resolutions, access denied!",
+ MessageBox.Show(App.GetTranslation("t_msg_custom_access_denied"),
App.NAME, MessageBoxButton.OK, MessageBoxImage.Warning);
return;
}
diff --git a/app/Languages/en.xaml b/app/Languages/en.xaml
index 8c9233c..32dfd9f 100644
--- a/app/Languages/en.xaml
+++ b/app/Languages/en.xaml
@@ -11,7 +11,6 @@
Custom...
Apply
Parent GPU
- Driver status
Language
@@ -32,4 +31,22 @@
Keep screen on
Check for update
Exit
+
+
+ Your app version is up-to-date.
+ A new version — v{0} is available.\nTo keep your experience optimal, please update it now."
+
+ Could not apply custom resolutions, access denied!
+ Found invalid value in slot #{0}.
+
+ Could not add more virtual displays, you have exceeded the maximum number ({0}).
+ All added virtual displays will be unplugged.\nDo you still want to exit?.
+
+ Driver status
+ You must restart your PC to complete the driver setup.
+ {0} is disabled, please enable it in Device Manager.
+ Please install the driver first.
+ The driver is not OK, please check again. Current status: {0}.
+ Failed to obtain the device handle, please check the driver installation again.
+
\ No newline at end of file
diff --git a/app/Languages/vi.xaml b/app/Languages/vi.xaml
index 9cdc547..177db56 100644
--- a/app/Languages/vi.xaml
+++ b/app/Languages/vi.xaml
@@ -34,6 +34,20 @@
Thoát
- Thoát
+ Bạn đang sử dụng phiên bản mới nhất.
+ Có bản cập nhật mới — v{0}.\nHãy cập nhật ngay để trải nghiệm các tính năng mới."
+
+ Không thể áp dụng độ phân giải tùy chỉnh, quyền truy cập bị từ chối!
+ Giá trị không hợp lệ ở slot #{0}.
+
+ Không thể cắm thêm màn hình ảo, bạn đã đạt đến con số giới hạn ({0}).
+ Tất cả màn hình ảo sẽ bị tháo bỏ.\nBạn có muốn thoát không?.
+
+ Trạng thái driver
+ Bạn phải khởi động lại PC để driver hoạt động.
+ {0} đã bị vô hiệu, vui lòng bật nó trong Device Manager.
+ Vui lòng cài đặt driver trước.
+ Driver không được OK, vui lòng kiểm tra lại. Trạng thái hiện tại: {0}.
+ Không thể lấy 'device handle', vui lòng kiểm tra cài đặt driver và thử lại.
\ No newline at end of file
diff --git a/app/MainWindow.xaml.cs b/app/MainWindow.xaml.cs
index 790262a..939ba2d 100644
--- a/app/MainWindow.xaml.cs
+++ b/app/MainWindow.xaml.cs
@@ -28,9 +28,6 @@ namespace ParsecVDisplay
// setup tray context menu
ContextMenu.DataContext = this;
ContextMenu.Resources = App.Current.Resources;
-
- Tray.Init(this, ContextMenu);
- ContextMenu = null;
}
protected override void OnSourceInitialized(EventArgs e)
@@ -68,6 +65,9 @@ namespace ParsecVDisplay
{
Loaded -= Window_Loaded;
+ Tray.Init(this, ContextMenu);
+ ContextMenu = null;
+
if (App.Silent)
Hide();
@@ -128,8 +128,7 @@ namespace ParsecVDisplay
{
if (ParsecVDD.DisplayCount >= ParsecVDD.MAX_DISPLAYS)
{
- MessageBox.Show(this,
- $"Could not add more virtual displays, you have exceeded the maximum number ({ParsecVDD.MAX_DISPLAYS}).",
+ MessageBox.Show(this, App.GetTranslation("t_msg_exceeded_display_limit", ParsecVDD.MAX_DISPLAYS),
Title, MessageBoxButton.OK, MessageBoxImage.Warning);
}
else
@@ -176,16 +175,15 @@ namespace ParsecVDisplay
var status = ParsecVDD.QueryStatus();
var version = ParsecVDD.QueryVersion();
- MessageBox.Show(this,
- $"Parsec Virtual Display v{version}\nDriver status: {status}",
+ MessageBox.Show(this, $"Parsec Virtual Display v{version}\n" +
+ $"{App.GetTranslation("t_msg_driver_status")}: {status}",
App.NAME, MessageBoxButton.OK, MessageBoxImage.Information);
}
private void ExitApp(object sender, EventArgs e)
{
if (ParsecVDD.DisplayCount > 0)
- if (MessageBox.Show(this,
- "All added virtual displays will be unplugged.\nDo you still want to exit?",
+ if (MessageBox.Show(this, App.GetTranslation("t_msg_prompt_leave_all"),
App.NAME, MessageBoxButton.YesNo, MessageBoxImage.Warning) != MessageBoxResult.Yes)
return;
@@ -211,9 +209,7 @@ namespace ParsecVDisplay
var newVersion = await Updater.CheckUpdate();
if (!string.IsNullOrEmpty(newVersion))
{
- var ret = MessageBox.Show(this,
- $"A new version — v{newVersion} is available!\n" +
- $"To keep your experience optimal, please update it now.",
+ var ret = MessageBox.Show(this, App.GetTranslation("t_msg_update_available", newVersion),
App.NAME, MessageBoxButton.YesNo, MessageBoxImage.Question);
if (ret == MessageBoxResult.Yes)
{
@@ -222,7 +218,7 @@ namespace ParsecVDisplay
}
else if (sender != null)
{
- MessageBox.Show(this, "Your app version is up-to-date.",
+ MessageBox.Show(this, App.GetTranslation("t_msg_up_to_date"),
App.NAME, MessageBoxButton.OK, MessageBoxImage.Information);
}