mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-04-09 04:37:30 +02:00
[Image Resizer]Localize units and resize mode (#31140)
* [Image Resizer] Do not use Culture when getting resources with ResourceLoader * Localize fit and unit comboboxes * Update font * Address PR comments
This commit is contained in:
@@ -13,24 +13,6 @@
|
|||||||
<ui:ControlsDictionary />
|
<ui:ControlsDictionary />
|
||||||
</ResourceDictionary.MergedDictionaries>
|
</ResourceDictionary.MergedDictionaries>
|
||||||
|
|
||||||
<ObjectDataProvider
|
|
||||||
x:Key="ResizeFitValues"
|
|
||||||
MethodName="GetValues"
|
|
||||||
ObjectType="sys:Enum">
|
|
||||||
<ObjectDataProvider.MethodParameters>
|
|
||||||
<x:Type Type="{x:Type m:ResizeFit}" />
|
|
||||||
</ObjectDataProvider.MethodParameters>
|
|
||||||
</ObjectDataProvider>
|
|
||||||
|
|
||||||
<ObjectDataProvider
|
|
||||||
x:Key="ResizeUnitValues"
|
|
||||||
MethodName="GetValues"
|
|
||||||
ObjectType="sys:Enum">
|
|
||||||
<ObjectDataProvider.MethodParameters>
|
|
||||||
<x:Type Type="{x:Type m:ResizeUnit}" />
|
|
||||||
</ObjectDataProvider.MethodParameters>
|
|
||||||
</ObjectDataProvider>
|
|
||||||
|
|
||||||
<v:SizeTypeToVisibilityConverter x:Key="SizeTypeToVisibilityConverter" />
|
<v:SizeTypeToVisibilityConverter x:Key="SizeTypeToVisibilityConverter" />
|
||||||
<v:EnumValueConverter x:Key="EnumValueConverter" />
|
<v:EnumValueConverter x:Key="EnumValueConverter" />
|
||||||
<v:AutoDoubleConverter x:Key="AutoDoubleConverter" />
|
<v:AutoDoubleConverter x:Key="AutoDoubleConverter" />
|
||||||
|
|||||||
@@ -2,6 +2,8 @@
|
|||||||
// The Brice Lambson licenses this file to you under the MIT license.
|
// The Brice Lambson licenses this file to you under the MIT license.
|
||||||
// See the LICENSE file in the project root for more information. Code forked from Brice Lambson's https://github.com/bricelam/ImageResizer/
|
// See the LICENSE file in the project root for more information. Code forked from Brice Lambson's https://github.com/bricelam/ImageResizer/
|
||||||
|
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Windows.Input;
|
using System.Windows.Input;
|
||||||
using Common.UI;
|
using Common.UI;
|
||||||
@@ -55,6 +57,10 @@ namespace ImageResizer.ViewModels
|
|||||||
|
|
||||||
public Settings Settings { get; }
|
public Settings Settings { get; }
|
||||||
|
|
||||||
|
public IEnumerable<ResizeFit> ResizeFitValues { get => Enum.GetValues(typeof(ResizeFit)).Cast<ResizeFit>(); }
|
||||||
|
|
||||||
|
public IEnumerable<ResizeUnit> ResizeUnitValues { get => Enum.GetValues(typeof(ResizeUnit)).Cast<ResizeUnit>(); }
|
||||||
|
|
||||||
public ICommand ResizeCommand { get; }
|
public ICommand ResizeCommand { get; }
|
||||||
|
|
||||||
public ICommand CancelCommand { get; }
|
public ICommand CancelCommand { get; }
|
||||||
|
|||||||
@@ -35,7 +35,10 @@ namespace ImageResizer.Views
|
|||||||
.Append(parameter);
|
.Append(parameter);
|
||||||
}
|
}
|
||||||
|
|
||||||
var targetValue = Resources.ResourceManager.GetString(builder.ToString(), culture);
|
// Fixes #16792 - Looks like culture defaults to en-US, so wrong resource is being fetched.
|
||||||
|
#pragma warning disable CA1304 // Specify CultureInfo
|
||||||
|
var targetValue = Resources.ResourceManager.GetString(builder.ToString());
|
||||||
|
#pragma warning restore CA1304 // Specify CultureInfo
|
||||||
|
|
||||||
if (toLower)
|
if (toLower)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -178,8 +178,17 @@
|
|||||||
Grid.Column="1"
|
Grid.Column="1"
|
||||||
HorizontalAlignment="Stretch"
|
HorizontalAlignment="Stretch"
|
||||||
AutomationProperties.Name="{x:Static p:Resources.Resize_Type}"
|
AutomationProperties.Name="{x:Static p:Resources.Resize_Type}"
|
||||||
ItemsSource="{Binding Source={StaticResource ResizeFitValues}}"
|
ItemsSource="{Binding ResizeFitValues, Mode=OneWay}"
|
||||||
Text="{Binding ElementName=SizeComboBox, Path=SelectedValue.Fit, Mode=TwoWay}" />
|
SelectedIndex="0">
|
||||||
|
<ComboBox.ItemTemplate>
|
||||||
|
<DataTemplate DataType="sys:Enum">
|
||||||
|
<TextBlock
|
||||||
|
Margin="4,0,0,0"
|
||||||
|
FontSize="14"
|
||||||
|
Text="{Binding {}, Converter={StaticResource EnumValueConverter}}" />
|
||||||
|
</DataTemplate>
|
||||||
|
</ComboBox.ItemTemplate>
|
||||||
|
</ComboBox>
|
||||||
|
|
||||||
<ui:SymbolIcon
|
<ui:SymbolIcon
|
||||||
Grid.Row="2"
|
Grid.Row="2"
|
||||||
@@ -196,8 +205,17 @@
|
|||||||
Grid.Row="2"
|
Grid.Row="2"
|
||||||
Grid.Column="4"
|
Grid.Column="4"
|
||||||
AutomationProperties.Name="{x:Static p:Resources.Unit}"
|
AutomationProperties.Name="{x:Static p:Resources.Unit}"
|
||||||
ItemsSource="{Binding Source={StaticResource ResizeUnitValues}}"
|
ItemsSource="{Binding ResizeUnitValues, Mode=OneWay}"
|
||||||
Text="{Binding ElementName=SizeComboBox, Path=SelectedValue.Unit, Mode=TwoWay}" />
|
SelectedIndex="0">
|
||||||
|
<ComboBox.ItemTemplate>
|
||||||
|
<DataTemplate DataType="sys:Enum">
|
||||||
|
<TextBlock
|
||||||
|
Margin="4,0,0,0"
|
||||||
|
FontSize="14"
|
||||||
|
Text="{Binding {}, Converter={StaticResource EnumValueConverter}}" />
|
||||||
|
</DataTemplate>
|
||||||
|
</ComboBox.ItemTemplate>
|
||||||
|
</ComboBox>
|
||||||
|
|
||||||
</Grid>
|
</Grid>
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user