Skip to content

Commit

Permalink
Fix ConfirmationPopup localization
Browse files Browse the repository at this point in the history
  • Loading branch information
CPKreu committed Apr 28, 2023
1 parent 6fc99b1 commit 579bbf5
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 14 deletions.
19 changes: 11 additions & 8 deletions src/PixiEditor/Views/Dialogs/ConfirmationPopup.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@
Name="popup" WindowStartupLocation="CenterScreen"
Height="180" Width="400" MinHeight="180" MinWidth="400"
WindowStyle="None"
FlowDirection="{helpers:Localization FlowDirection}">
FlowDirection="{helpers:Localization FlowDirection}"
d:DataContext="{d:DesignInstance dial:ConfirmationPopup}">

<WindowChrome.WindowChrome>
<WindowChrome CaptionHeight="32" GlassFrameThickness="0.1"
Expand All @@ -29,27 +30,29 @@
<dial:DialogTitleBar DockPanel.Dock="Top"
TitleText="{Binding ElementName=popup, Path=Title}" CloseCommand="{Binding DataContext.CancelCommand, ElementName=popup}" />

<StackPanel DockPanel.Dock="Bottom" Grid.Row="2" Orientation="Horizontal" HorizontalAlignment="Center"
<StackPanel DockPanel.Dock="Bottom" Orientation="Horizontal" HorizontalAlignment="Center"
Margin="0,0,10,15">
<Button Margin="10,0,10,0" MinWidth="70" IsDefault="True" Padding="5 0"
<Button Margin="10,0,10,0" IsDefault="True" Padding="5 0"
Command="{Binding Path=DataContext.SetResultAndCloseCommand, ElementName=popup}"
Style="{StaticResource DarkRoundButton}" Content="{Binding Path=DataContext.FirstOptionText}">
views:Translator.LocalizedString="{Binding FirstOptionText}"
Style="{StaticResource DarkRoundButton}">
<Button.CommandParameter>
<system:Boolean>True</system:Boolean>
</Button.CommandParameter>
</Button>
<Button MinWidth="70" Padding="5 0"
<Button Padding="5 0"
Command="{Binding Path=DataContext.SetResultAndCloseCommand, ElementName=popup}"
Style="{StaticResource DarkRoundButton}" Content="{Binding Path=DataContext.SecondOptionText}">
views:Translator.LocalizedString="{Binding SecondOptionText}"
Style="{StaticResource DarkRoundButton}">
<Button.CommandParameter>
<system:Boolean>False</system:Boolean>
</Button.CommandParameter>
</Button>
<Button Margin="10,0,10,0" Width="70" Style="{StaticResource DarkRoundButton}" views:Translator.Key="CANCEL"
<Button Margin="10,0,10,0" Style="{StaticResource DarkRoundButton}" views:Translator.Key="CANCEL"
Command="{Binding DataContext.CancelCommand, ElementName=popup}" />
</StackPanel>

<TextBlock Grid.Row="1"
<TextBlock
Text="{Binding Body, ElementName=popup}"
HorizontalAlignment="Center" Margin="20,0"
TextWrapping="WrapWithOverflow"
Expand Down
12 changes: 6 additions & 6 deletions src/PixiEditor/Views/Dialogs/ConfirmationPopup.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,20 +17,20 @@ internal partial class ConfirmationPopup : Window
DependencyProperty.Register(nameof(Body), typeof(string), typeof(ConfirmationPopup), new PropertyMetadata(""));

public static readonly DependencyProperty FirstOptionTextProperty = DependencyProperty.Register(
nameof(FirstOptionText), typeof(string), typeof(ConfirmationPopup), new PropertyMetadata(new LocalizedString("YES").Value));
nameof(FirstOptionText), typeof(LocalizedString), typeof(ConfirmationPopup), new PropertyMetadata(new LocalizedString("YES")));

public string FirstOptionText
public LocalizedString FirstOptionText
{
get { return (string)GetValue(FirstOptionTextProperty); }
get { return (LocalizedString)GetValue(FirstOptionTextProperty); }
set { SetValue(FirstOptionTextProperty, value); }
}

public static readonly DependencyProperty SecondOptionTextProperty = DependencyProperty.Register(
nameof(SecondOptionText), typeof(string), typeof(ConfirmationPopup), new PropertyMetadata(new LocalizedString("NO").Value));
nameof(SecondOptionText), typeof(LocalizedString), typeof(ConfirmationPopup), new PropertyMetadata(new LocalizedString("NO")));

public string SecondOptionText
public LocalizedString SecondOptionText
{
get { return (string)GetValue(SecondOptionTextProperty); }
get { return (LocalizedString)GetValue(SecondOptionTextProperty); }
set { SetValue(SecondOptionTextProperty, value); }
}

Expand Down

0 comments on commit 579bbf5

Please sign in to comment.