diff options
author | sr55 <[email protected]> | 2021-01-09 21:51:00 +0000 |
---|---|---|
committer | sr55 <[email protected]> | 2021-01-09 21:51:00 +0000 |
commit | 413bf9f67ba703a97df384e17b1dd02a8f1c0981 (patch) | |
tree | d2029628c83f94afaae968acb286ddf85800aa88 /win | |
parent | b646b92ed756805caf6a3eb0392d3aa55f1b2856 (diff) |
WinGui: Add experimental support for Right to Left languages. This globally inverts the UI.
Diffstat (limited to 'win')
-rw-r--r-- | win/CS/HandBrakeWPF/Model/InterfaceLanguage.cs | 8 | ||||
-rw-r--r-- | win/CS/HandBrakeWPF/Views/ShellView.xaml.cs | 21 |
2 files changed, 25 insertions, 4 deletions
diff --git a/win/CS/HandBrakeWPF/Model/InterfaceLanguage.cs b/win/CS/HandBrakeWPF/Model/InterfaceLanguage.cs index 3a10b8811..7ec4c39d3 100644 --- a/win/CS/HandBrakeWPF/Model/InterfaceLanguage.cs +++ b/win/CS/HandBrakeWPF/Model/InterfaceLanguage.cs @@ -11,18 +11,18 @@ namespace HandBrakeWPF.Model { public class InterfaceLanguage { - public InterfaceLanguage() - { - } + - public InterfaceLanguage(string culture, string name) + public InterfaceLanguage(string culture, string name, bool rtl = false) { this.Culture = culture; this.Name = name; + this.RightToLeft = rtl; } public string Culture { get; set; } public string Name { get; set; } + public bool RightToLeft { get; set; } protected bool Equals(InterfaceLanguage other) { diff --git a/win/CS/HandBrakeWPF/Views/ShellView.xaml.cs b/win/CS/HandBrakeWPF/Views/ShellView.xaml.cs index 8b6b5b30e..4e7266f8b 100644 --- a/win/CS/HandBrakeWPF/Views/ShellView.xaml.cs +++ b/win/CS/HandBrakeWPF/Views/ShellView.xaml.cs @@ -12,7 +12,9 @@ namespace HandBrakeWPF.Views using System;
using System.ComponentModel;
using System.Drawing;
+ using System.Globalization;
using System.IO;
+ using System.Threading;
using System.Windows;
using System.Windows.Forms;
using System.Windows.Input;
@@ -21,12 +23,14 @@ namespace HandBrakeWPF.Views using Caliburn.Micro;
using HandBrakeWPF.Commands;
+ using HandBrakeWPF.Model;
using HandBrakeWPF.Services.Interfaces;
using HandBrakeWPF.Utilities;
using HandBrakeWPF.ViewModels.Interfaces;
using Application = System.Windows.Application;
using Execute = Caliburn.Micro.Execute;
+ using FlowDirection = System.Windows.FlowDirection;
/// <summary>
/// Interaction logic for ShellView.xaml
@@ -94,6 +98,23 @@ namespace HandBrakeWPF.Views {
this.TaskbarItemInfo = Win7.WindowsTaskbar;
}
+
+ // Setup the UI Language
+ string culture = userSettingService.GetUserSetting<string>(UserSettingConstants.UiLanguage);
+ if (!string.IsNullOrEmpty(culture))
+ {
+ InterfaceLanguage language = InterfaceLanguageUtilities.FindInterfaceLanguage(culture);
+ if (language != null)
+ {
+ if (language.RightToLeft)
+ {
+ if (Application.Current.MainWindow != null)
+ {
+ Application.Current.MainWindow.FlowDirection = FlowDirection.RightToLeft;
+ }
+ }
+ }
+ }
}
/// <summary>
|