Merge pull request #1612 from onesounds/FixBoolToTranslation

Translatable Bool in List view
This commit is contained in:
Jeremy Wu 2022-12-12 20:07:04 +11:00 committed by GitHub
commit 4153aa9a69
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 63 additions and 26 deletions

View file

@ -101,7 +101,7 @@
DockPanel.Dock="Right" />
<TextBox
Name="Directory"
MinWidth="300"
Width="350"
Margin="10"
HorizontalAlignment="Stretch"
VerticalAlignment="Center" />

View file

@ -12,6 +12,9 @@
<system:String x:Key="flowlauncher_plugin_program_enable">Enable</system:String>
<system:String x:Key="flowlauncher_plugin_program_enabled">Enabled</system:String>
<system:String x:Key="flowlauncher_plugin_program_disable">Disable</system:String>
<system:String x:Key="flowlauncher_plugin_program_status">Status</system:String>
<system:String x:Key="flowlauncher_plugin_program_true">Enabled</system:String>
<system:String x:Key="flowlauncher_plugin_program_false">Disabled</system:String>
<system:String x:Key="flowlauncher_plugin_program_location">Location</system:String>
<system:String x:Key="flowlauncher_plugin_program_all_programs">All Programs</system:String>
<system:String x:Key="flowlauncher_plugin_program_suffixes">File Type</system:String>
@ -28,7 +31,7 @@
<system:String x:Key="flowlauncher_plugin_program_enable_hidelnkpath">Hide app path</system:String>
<system:String x:Key="flowlauncher_plugin_program_enable_hidelnkpath_tooltip">For executable files such as UWP or lnk, hide the file path from being visible</system:String>
<system:String x:Key="flowlauncher_plugin_program_enable_description">Search in Program Description</system:String>
<system:String x:Key="flowlauncher_plugin_program_enable_description_tooltip">Disabling this will also stop Flow from searching via the program desciption</system:String>
<system:String x:Key="flowlauncher_plugin_program_enable_description_tooltip">Flow will search program's description</system:String>
<system:String x:Key="flowlauncher_plugin_program_suffixes_header">Suffixes</system:String>
<system:String x:Key="flowlauncher_plugin_program_max_depth_header">Max Depth</system:String>

View file

@ -90,10 +90,9 @@
BorderBrush="{DynamicResource Color03B}"
BorderThickness="1" />
<StackPanel
Width="Auto"
Height="55"
Margin="60,6,0,0"
Margin="60,0,0,2"
HorizontalAlignment="Left"
VerticalAlignment="Center"
Orientation="Horizontal">
<Button
x:Name="btnLoadAllProgramSource"
@ -149,7 +148,8 @@
MouseDoubleClick="programSourceView_MouseDoubleClick"
PreviewMouseRightButtonUp="ProgramSourceView_PreviewMouseRightButtonUp"
SelectionChanged="programSourceView_SelectionChanged"
SelectionMode="Extended">
SelectionMode="Extended"
SizeChanged="ListView_SizeChanged">
<ListView.View>
<GridView>
<GridViewColumn Width="150" Header="{DynamicResource flowlauncher_plugin_program_name}">
@ -159,20 +159,28 @@
</DataTemplate>
</GridViewColumn.CellTemplate>
</GridViewColumn>
<GridViewColumn Header="{DynamicResource flowlauncher_plugin_program_enabled}">
<GridViewColumn Width="90" Header="{DynamicResource flowlauncher_plugin_program_status}">
<GridViewColumn.CellTemplate>
<DataTemplate>
<TextBlock
MaxWidth="60"
Text="{Binding Enabled}"
TextAlignment="Center" />
<TextBlock TextAlignment="Left">
<TextBlock.Style>
<Style TargetType="TextBlock">
<Setter Property="Text" Value="{DynamicResource flowlauncher_plugin_program_false}" />
<Style.Triggers>
<DataTrigger Binding="{Binding Enabled, UpdateSourceTrigger=PropertyChanged}" Value="True">
<Setter Property="Text" Value="{DynamicResource flowlauncher_plugin_program_true}" />
</DataTrigger>
</Style.Triggers>
</Style>
</TextBlock.Style>
</TextBlock>
</DataTemplate>
</GridViewColumn.CellTemplate>
</GridViewColumn>
<GridViewColumn Width="550" Header="{DynamicResource flowlauncher_plugin_program_location}">
<GridViewColumn Header="{DynamicResource flowlauncher_plugin_program_location}">
<GridViewColumn.CellTemplate>
<DataTemplate>
<TextBlock Text="{Binding Location, ConverterParameter=(null), Converter={program:LocationConverter}}" />
<TextBlock Text="{Binding Location, ConverterParameter=(null), Converter={program:LocationConverter}}" TextTrimming="CharacterEllipsis" />
</DataTemplate>
</GridViewColumn.CellTemplate>
</GridViewColumn>
@ -182,7 +190,7 @@
<DockPanel
Grid.Row="3"
Grid.RowSpan="1"
Margin="0,0,20,10">
Margin="0,0,20,0">
<StackPanel HorizontalAlignment="Right" Orientation="Horizontal">
<Button
x:Name="btnProgramSourceStatus"

View file

@ -9,6 +9,7 @@ using Flow.Launcher.Plugin.Program.Views.Commands;
using Flow.Launcher.Plugin.Program.Programs;
using System.ComponentModel;
using System.Windows.Data;
using System;
namespace Flow.Launcher.Plugin.Program.Views
{
@ -383,5 +384,20 @@ namespace Flow.Launcher.Plugin.Program.Views
{
return items.All(x => _settings.ProgramSources.Any(y => y.UniqueIdentifier == x.UniqueIdentifier));
}
private void ListView_SizeChanged(object sender, SizeChangedEventArgs e)
{
ListView listView = sender as ListView;
GridView gView = listView.View as GridView;
var workingWidth = listView.ActualWidth - SystemParameters.VerticalScrollBarWidth; // take into account vertical scrollbar
var col1 = 0.25;
var col2 = 0.15;
var col3 = 0.60;
gView.Columns[0].Width = workingWidth * col1;
gView.Columns[1].Width = workingWidth * col2;
gView.Columns[2].Width = workingWidth * col3;
}
}
}

View file

@ -12,6 +12,8 @@
<system:String x:Key="flowlauncher_plugin_websearch_delete">Delete</system:String>
<system:String x:Key="flowlauncher_plugin_websearch_edit">Edit</system:String>
<system:String x:Key="flowlauncher_plugin_websearch_add">Add</system:String>
<system:String x:Key="flowlauncher_plugin_websearch_true">Enabled</system:String>
<system:String x:Key="flowlauncher_plugin_websearch_false">Disabled</system:String>
<system:String x:Key="flowlauncher_plugin_websearch_confirm">Confirm</system:String>
<system:String x:Key="flowlauncher_plugin_websearch_action_keyword">Action Keyword</system:String>
<system:String x:Key="flowlauncher_plugin_websearch_url">URL</system:String>
@ -32,7 +34,7 @@
<!-- web search edit -->
<system:String x:Key="flowlauncher_plugin_websearch_title">Title</system:String>
<system:String x:Key="flowlauncher_plugin_websearch_enable">Enable</system:String>
<system:String x:Key="flowlauncher_plugin_websearch_enable">Status</system:String>
<system:String x:Key="flowlauncher_plugin_websearch_select_icon">Select Icon</system:String>
<system:String x:Key="flowlauncher_plugin_websearch_icon">Icon</system:String>
<system:String x:Key="flowlauncher_plugin_websearch_cancel">Cancel</system:String>

View file

@ -35,7 +35,7 @@
</DockPanel>
</DataTemplate>
</UserControl.Resources>
<Grid Margin="14,14,14,0">
<Grid Margin="0,4,0,0">
<Grid.RowDefinitions>
<RowDefinition />
<RowDefinition Height="56" />
@ -44,7 +44,7 @@
<ListView
x:Name="SearchSourcesListView"
Grid.Row="0"
Margin="0,18,0,0"
Margin="18,18,18,0"
BorderBrush="DarkGray"
BorderThickness="1"
GridViewColumnHeader.Click="SortByColumn"
@ -86,13 +86,21 @@
</DataTemplate>
</GridViewColumn.CellTemplate>
</GridViewColumn>
<GridViewColumn
Width="80"
DisplayMemberBinding="{Binding Enabled}"
Header="{DynamicResource flowlauncher_plugin_websearch_enable}">
<GridViewColumn Width="140" Header="{DynamicResource flowlauncher_plugin_websearch_enable}">
<GridViewColumn.CellTemplate>
<DataTemplate>
<TextBlock Text="{Binding Enabled}" />
<TextBlock>
<TextBlock.Style>
<Style TargetType="TextBlock">
<Setter Property="Text" Value="{DynamicResource flowlauncher_plugin_websearch_false}" />
<Style.Triggers>
<DataTrigger Binding="{Binding Enabled, UpdateSourceTrigger=PropertyChanged}" Value="True">
<Setter Property="Text" Value="{DynamicResource flowlauncher_plugin_websearch_true}" />
</DataTrigger>
</Style.Triggers>
</Style>
</TextBlock.Style>
</TextBlock>
</DataTemplate>
</GridViewColumn.CellTemplate>
</GridViewColumn>
@ -115,7 +123,7 @@
Content="{DynamicResource flowlauncher_plugin_websearch_edit}" />
<Button
Width="100"
Margin="10,10,0,10"
Margin="10,10,18,10"
Click="OnAddSearchSearchClick"
Content="{DynamicResource flowlauncher_plugin_websearch_add}" />
</StackPanel>
@ -123,9 +131,9 @@
Grid.Row="2"
Margin="0,0,0,0"
HorizontalAlignment="Stretch"
BorderBrush="#cecece"
BorderBrush="{DynamicResource Color03B}"
BorderThickness="0,1,0,0">
<DockPanel Margin="0,14,0,0" HorizontalAlignment="Right">
<DockPanel HorizontalAlignment="Right">
<StackPanel DockPanel.Dock="Right" Orientation="Horizontal">
<Label
Margin="14,0,10,0"
@ -147,7 +155,7 @@
Content="{DynamicResource flowlauncher_plugin_websearch_enable_suggestion}" />
<CheckBox
Name="EnableSuggestion"
Margin="0,0,0,0"
Margin="0,0,8,0"
IsChecked="{Binding Settings.EnableSuggestion}" />
</StackPanel>
<!-- Not sure why binding IsEnabled directly to Settings.EnableWebSaerchSuggestion is not working -->