diff options
author | Eric Maupin <ermaup@microsoft.com> | 2019-08-29 21:59:07 +0300 |
---|---|---|
committer | Eric Maupin <ermaup@microsoft.com> | 2019-08-29 21:59:07 +0300 |
commit | 7176d845f6505f9f89cba97d8a77cde5dfd7f1ff (patch) | |
tree | 677dc89182310937a6788247f7bb4e92052b22d5 /Xamarin.PropertyEditing.Windows | |
parent | f3261220431b863aa3ef5cfab5464f53078cf2f5 (diff) |
[Win] Localize arrange menu
Diffstat (limited to 'Xamarin.PropertyEditing.Windows')
4 files changed, 36 insertions, 2 deletions
diff --git a/Xamarin.PropertyEditing.Windows/ArrangeModeLocalizedConverter.cs b/Xamarin.PropertyEditing.Windows/ArrangeModeLocalizedConverter.cs new file mode 100644 index 0000000..96d3bc3 --- /dev/null +++ b/Xamarin.PropertyEditing.Windows/ArrangeModeLocalizedConverter.cs @@ -0,0 +1,32 @@ +using System; +using System.Globalization; +using System.Windows.Data; +using Xamarin.PropertyEditing.Properties; + +namespace Xamarin.PropertyEditing.Windows +{ + internal class ArrangeModeLocalizedConverter + : IValueConverter + { + public object Convert (object value, Type targetType, object parameter, CultureInfo culture) + { + if (value is PropertyArrangeMode mode) { + switch (mode) { + case PropertyArrangeMode.Category: + return Resources.ArrangeByCategory; + case PropertyArrangeMode.Name: + return Resources.ArrangeByName; + case PropertyArrangeMode.ValueSource: + return Resources.ArrangeByValueSource; + } + } + + return value?.ToString (); + } + + public object ConvertBack (object value, Type targetType, object parameter, CultureInfo culture) + { + throw new NotImplementedException (); + } + } +}
\ No newline at end of file diff --git a/Xamarin.PropertyEditing.Windows/Themes/PropertyEditorPanelStyle.xaml b/Xamarin.PropertyEditing.Windows/Themes/PropertyEditorPanelStyle.xaml index 7e21ce0..32d347c 100644 --- a/Xamarin.PropertyEditing.Windows/Themes/PropertyEditorPanelStyle.xaml +++ b/Xamarin.PropertyEditing.Windows/Themes/PropertyEditorPanelStyle.xaml @@ -10,6 +10,7 @@ <local:OppositeBoolConverter x:Key="OppositeBoolConverter" /> <local:EditorPropertySelector x:Key="PropertyEditorSelector" /> <local:EditorTreeSelector x:Key="EditorTreeSelector" EditorTemplateKey="PropertyEditorTemplate" ParentTemplateKey="PropertyGroupTemplate" /> + <local:ArrangeModeLocalizedConverter x:Key="ArrangeLocalizer" /> <Style x:Key="TreeExpanderStyle" TargetType="Expander"> <Setter Property="Foreground" Value="{DynamicResource PanelGroupForegroundBrush}" /> @@ -210,7 +211,7 @@ <local:TextBoxEx x:Name="search" Grid.Row="0" Style="{DynamicResource PropertySearchTextBox}" AutomationProperties.Name="{x:Static prop:Resources.SearchProperties}" Text="{Binding FilterText,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}" /> - <local:MenuButton Grid.Row="1" x:Name="arrangeBy" Header="Arrange by:" Margin="0,0,18,0" Content="{Binding ArrangeMode}"> + <local:MenuButton Grid.Row="1" x:Name="arrangeBy" Header="{x:Static prop:Resources.ArrangeByLabel}" Margin="0,0,18,0" Content="{Binding ArrangeMode,Converter={StaticResource ArrangeLocalizer}}"> <local:MenuButton.Visibility> <Binding RelativeSource="{RelativeSource TemplatedParent}" Path="IsArrangeEnabled"> <Binding.Converter> diff --git a/Xamarin.PropertyEditing.Windows/Themes/Resources.xaml b/Xamarin.PropertyEditing.Windows/Themes/Resources.xaml index 199156c..b47da40 100644 --- a/Xamarin.PropertyEditing.Windows/Themes/Resources.xaml +++ b/Xamarin.PropertyEditing.Windows/Themes/Resources.xaml @@ -1898,7 +1898,7 @@ </Style> <Style x:Key="ArrangeMenuItem" TargetType="MenuItem" BasedOn="{StaticResource {x:Type MenuItem}}"> - <Setter Property="Header" Value="{Binding ArrangeMode,Mode=OneTime}" /> + <Setter Property="Header" Value="{Binding ArrangeMode,Mode=OneTime,Converter={StaticResource ArrangeLocalizer}}" /> <Setter Property="IsCheckable" Value="True" /> <Setter Property="IsChecked" Value="{Binding IsChecked,Mode=TwoWay}" /> </Style> diff --git a/Xamarin.PropertyEditing.Windows/Xamarin.PropertyEditing.Windows.csproj b/Xamarin.PropertyEditing.Windows/Xamarin.PropertyEditing.Windows.csproj index 94d481b..85322e5 100644 --- a/Xamarin.PropertyEditing.Windows/Xamarin.PropertyEditing.Windows.csproj +++ b/Xamarin.PropertyEditing.Windows/Xamarin.PropertyEditing.Windows.csproj @@ -51,6 +51,7 @@ <Compile Include="..\Xamarin.PropertyEditing\Properties\GlobalAssemblyInfo.cs"> <Link>Properties\GlobalAssemblyInfo.cs</Link> </Compile> + <Compile Include="ArrangeModeLocalizedConverter.cs" /> <Compile Include="BoolEditorControl.cs" /> <Compile Include="BoolsToVisibilityConverter.cs" /> <Compile Include="BrushBoxControl.cs" /> |