Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions DS4Windows/App.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@

<!--<SolidColorBrush x:Key="ForegroundColor" Color="{x:Static SystemColors.ActiveCaptionTextColor}" />-->

<!-- Live-updatable layout direction, set from code (App.xaml.cs -> SetUICulture) based on the selected language -->
<FlowDirection x:Key="AppFlowDirection">LeftToRight</FlowDirection>

<Style TargetType="{x:Type Button}" x:Key="NoBGHoverBtn">
<Setter Property="Background" Value="Transparent" />
<Setter Property="Template">
Expand Down
24 changes: 24 additions & 0 deletions DS4Windows/App.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,14 @@ public struct COPYDATASTRUCT

private void Application_Startup(object sender, StartupEventArgs e)
{
// Flip only each window's *content* to match the selected culture's reading direction,
// never the Window object itself -- setting FlowDirection on the Window would also mirror
// the native window chrome (min/max/close button side) and any image/icon inside, which we
// don't want. The actual direction value is kept in the "AppFlowDirection" resource and
// updated from SetUICulture whenever the language changes.
EventManager.RegisterClassHandler(typeof(Window), FrameworkElement.LoadedEvent,
new RoutedEventHandler(SyncWindowContentFlowDirection));

runShutdown = true;
skipSave = true;

Expand Down Expand Up @@ -677,6 +685,15 @@ public void WriteIPCResultDataMMF(string dataStr)
}
}

private void SyncWindowContentFlowDirection(object sender, RoutedEventArgs e)
{
if (sender is Window window && window.Content is FrameworkElement rootContent &&
Application.Current.Resources["AppFlowDirection"] is FlowDirection dir)
{
rootContent.FlowDirection = dir;
}
}

private void SetUICulture(string culture)
{
try
Expand All @@ -691,6 +708,13 @@ private void SetUICulture(string culture)
//DS4WinWPF.Properties.Resources.Culture = ci;
Thread.CurrentThread.CurrentCulture = ci;
Thread.CurrentThread.CurrentUICulture = ci;

// Match content layout direction to the selected culture (RTL for fa/ar/he, etc.).
// Stored as a resource that SyncWindowContentFlowDirection reads whenever a window
// loads, and applied only to each window's Content -- never the Window object itself,
// so native window chrome (min/max/close button side) and images stay unaffected.
Application.Current.Resources["AppFlowDirection"] =
ci.TextInfo.IsRightToLeft ? FlowDirection.RightToLeft : FlowDirection.LeftToRight;
}
catch (CultureNotFoundException) { /* Skip setting culture that we cannot set */ }
}
Expand Down
6 changes: 3 additions & 3 deletions DS4Windows/DS4Control/ControlService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1708,15 +1708,15 @@ public bool Start(bool showlog = true)
string logMessage = string.Empty;
if (!vigemInstalled)
{
logMessage = "ViGEmBus is not installed";
logMessage = DS4WinWPF.Translations.Strings.ViGEmBusNotInstalled;
}
else if (!Global.IsRunningSupportedViGEmBus())
{
logMessage = string.Format("Unsupported ViGEmBus found ({0}). Please install at least ViGEmBus 1.17.333.0", Global.vigembusVersion);
logMessage = string.Format(DS4WinWPF.Translations.Strings.ViGEmBusUnsupportedVersion, Global.vigembusVersion);
}
else
{
logMessage = "Could not connect to ViGEmBus. Please check the status of the System device in Device Manager and if Visual C++ 2017 Redistributable is installed.";
logMessage = DS4WinWPF.Translations.Strings.ViGEmBusConnectFailed;
}

LogDebug(logMessage);
Expand Down
2 changes: 1 addition & 1 deletion DS4Windows/DS4Forms/LanguagePackControl.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
d:DesignHeight="30" d:DesignWidth="340">
<StackPanel Orientation="Horizontal">
<Label x:Name="label1" Content="{lex:Loc LangPackControl.UseLangPack}" ContentStringFormat="{}{0}:" />
<ComboBox x:Name="cbCulture" Width="200" Margin="10,0,0,0"
<ComboBox x:Name="cbCulture" Width="200" Margin="10,0,0,0" FlowDirection="LeftToRight"
ItemsSource="{Binding LangPackList}" SelectedIndex="{Binding SelectedIndex,FallbackValue=0}" IsEnabled="False">
<ComboBox.ItemTemplate>
<DataTemplate>
Expand Down
6 changes: 3 additions & 3 deletions DS4Windows/DS4Forms/PresetOptionWindow.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
lex:ResxLocalizationProvider.DefaultAssembly="DS4Windows"
lex:ResxLocalizationProvider.DefaultDictionary="Strings"
mc:Ignorable="d"
Title="Select Preset" Height="250" Width="600" Padding="0"
Title="{lex:Loc PresetOptWin.WinTitle}" Height="250" Width="600" Padding="0"
Style="{DynamicResource WindowStyle}" Closed="Window_Closed">
<Window.Resources>
<BooleanToVisibilityConverter x:Key="BooleanToVisibilityConverter"/>
Expand All @@ -20,8 +20,8 @@
<TabItem x:Name="IntroTab" Header="{lex:Loc Intro}">
<DockPanel Margin="4,0,4,8">
<StackPanel Orientation="Horizontal" DockPanel.Dock="Bottom" HorizontalAlignment="Right">
<Button x:Name="noPresetBtn" Content="No" MinWidth="60" Margin="0,0,20,0" TabIndex="0" Click="NoPresetBtn_Click" />
<Button x:Name="yesPresetBtn" Content="Yes" MinWidth="60" TabIndex="1" Click="YesPresetBtn_Click" />
<Button x:Name="noPresetBtn" Content="{lex:Loc No}" MinWidth="60" Margin="0,0,20,0" TabIndex="0" Click="NoPresetBtn_Click" />
<Button x:Name="yesPresetBtn" Content="{lex:Loc Yes}" MinWidth="60" TabIndex="1" Click="YesPresetBtn_Click" />
</StackPanel>
<StackPanel>
<TextBlock Text="{lex:Loc PresetIntrotext}" TextWrapping="Wrap" />
Expand Down
4 changes: 2 additions & 2 deletions DS4Windows/DS4Forms/UpdaterWindow.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,14 @@
Title="{lex:Loc UpdaterWin.WinTitle}" Height="450" Width="800"
Style="{DynamicResource WindowStyle}" Closed="Window_Closed">
<DockPanel Margin="8,0">
<TextBlock x:Name="captionTextBlock" Text="{Binding IntroText}" DockPanel.Dock="Top" Margin="0,4" />
<TextBlock x:Name="captionTextBlock" Text="{Binding IntroText}" DockPanel.Dock="Top" Margin="0,4" FlowDirection="LeftToRight" />
<StackPanel Orientation="Horizontal" DockPanel.Dock="Bottom" HorizontalAlignment="Right" Margin="0,0,0,8">
<Button x:Name="skipVersionBtn" Content="{lex:Loc SkipVersion}" MinWidth="80" Click="SkipVersionBtn_Click" />
<Button x:Name="yesBtn" Content="{lex:Loc Yes}" MinWidth="60" Click="YesBtn_Click" Margin="10,0,0,0" />
<Button x:Name="noBtn" Content="{lex:Loc No}" MinWidth="60" Click="NoBtn_Click" Margin="10,0,0,0" />
</StackPanel>

<mdxam:MarkdownScrollViewer Margin="0,8" Markdown="{Binding Markdown}"
ClickAction="OpenBrowser" MarkdownStyle="{StaticResource DocumentStyleGithubLike}" />
ClickAction="OpenBrowser" MarkdownStyle="{StaticResource DocumentStyleGithubLike}" FlowDirection="LeftToRight" />
</DockPanel>
</Window>
4 changes: 2 additions & 2 deletions DS4Windows/DS4Forms/WelcomeDialog.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
<Run Text="{lex:Loc Welcome.BluetoothSettings}" />
</Hyperlink>
</TextBlock>
<Image Source="{Binding Source={StaticResource resourcePaths}, Path=PairmodePNG}" Height="80" DockPanel.Dock="Top" />
<Image Source="{Binding Source={StaticResource resourcePaths}, Path=PairmodePNG}" Height="80" DockPanel.Dock="Top" FlowDirection="LeftToRight" />
</DockPanel>

<StackPanel x:Name="step4HidHidePanel" DockPanel.Dock="Top" Margin="0,8,0,0">
Expand All @@ -69,7 +69,7 @@
</TextBlock>
</StackPanel>

<Button x:Name="finishedBtn" Content="Finished" HorizontalAlignment="Center" Padding="10,1" Style="{StaticResource CommonMargin}" Click="FinishedBtn_Click" DockPanel.Dock="Bottom" />
<Button x:Name="finishedBtn" Content="{lex:Loc Finished}" HorizontalAlignment="Center" Padding="10,1" Style="{StaticResource CommonMargin}" Click="FinishedBtn_Click" DockPanel.Dock="Bottom" />
</DockPanel>
</ScrollViewer>
</Window>
29 changes: 28 additions & 1 deletion DS4Windows/Translations/Strings.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion DS4Windows/Translations/Strings.ar.resx
Original file line number Diff line number Diff line change
Expand Up @@ -428,7 +428,7 @@ Gryo معين كفأرة</value>
<value>ملفات التعريف</value>
</data>
<data name="NoControllersConnected" xml:space="preserve">
<value>(لا توجد أيادي تحكم متصلة (الأقصى {0}</value>
<value>لا توجد أيادي تحكم متصلة (الأقصى {0})</value>
</data>
<data name="FlickThreshold" xml:space="preserve">
<value>بداية النقرة</value>
Expand Down
Loading