Skip to content

Commit 4a50eec

Browse files
committed
Remove TranslationConverter & project reference in Explorer plugin
1 parent 6144d4a commit 4a50eec

File tree

7 files changed

+14
-33
lines changed

7 files changed

+14
-33
lines changed

Flow.Launcher.Core/Resource/TranslationConverter.cs

Lines changed: 0 additions & 25 deletions
This file was deleted.

Flow.Launcher.Infrastructure/UserSettings/CustomShortcutModel.cs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
using System;
22
using System.Text.Json.Serialization;
33
using System.Threading.Tasks;
4+
using CommunityToolkit.Mvvm.DependencyInjection;
5+
using Flow.Launcher.Plugin;
46

57
namespace Flow.Launcher.Infrastructure.UserSettings
68
{
@@ -53,6 +55,12 @@ public class BaseBuiltinShortcutModel : ShortcutBaseModel
5355
{
5456
public string Description { get; set; }
5557

58+
public string LocalizedDescription => API.GetTranslation(Description);
59+
60+
// We should not initialize API in static constructor because it will create another API instance
61+
private static IPublicAPI api = null;
62+
private static IPublicAPI API => api ??= Ioc.Default.GetRequiredService<IPublicAPI>();
63+
5664
public BaseBuiltinShortcutModel(string key, string description)
5765
{
5866
Key = key;

Flow.Launcher/Resources/SettingWindowStyle.xaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
<converters:BorderClipConverter x:Key="BorderClipConverter" />
77
<converters:BoolToVisibilityConverter x:Key="BoolToVisibilityConverter" />
88
<converters:TextConverter x:Key="TextConverter" />
9-
<core:TranslationConverter x:Key="TranslationConverter" />
109

1110
<!-- Icon for Theme Type Label -->
1211
<Geometry x:Key="circle_half_stroke_solid">F1 M512,512z M0,0z M448,256C448,150,362,64,256,64L256,448C362,448,448,362,448,256z M0,256A256,256,0,1,1,512,256A256,256,0,1,1,0,256z</Geometry>

Flow.Launcher/SettingPages/Views/SettingsPaneHotkey.xaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -424,7 +424,7 @@
424424
<GridViewColumn Width="430" Header="{DynamicResource builtinShortcutDescription}">
425425
<GridViewColumn.CellTemplate>
426426
<DataTemplate DataType="{x:Type userSettings:BuiltinShortcutModel}">
427-
<TextBlock Text="{Binding Description, Converter={StaticResource TranslationConverter}}" />
427+
<TextBlock Text="{Binding LocalizedDescription}" />
428428
</DataTemplate>
429429
</GridViewColumn.CellTemplate>
430430
</GridViewColumn>

Plugins/Flow.Launcher.Plugin.Explorer/Flow.Launcher.Plugin.Explorer.csproj

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,15 +46,14 @@
4646

4747
<ItemGroup>
4848
<PackageReference Include="CommunityToolkit.Mvvm" Version="8.4.0" />
49+
<PackageReference Include="Droplex" Version="1.7.0" />
4950
<!-- Do not upgrade System.Data.OleDb since we are .Net7.0 -->
5051
<PackageReference Include="System.Data.OleDb" Version="8.0.1" />
5152
<PackageReference Include="System.Linq.Async" Version="6.0.1" />
5253
<PackageReference Include="tlbimp-Microsoft.Search.Interop" Version="1.0.0" />
5354
</ItemGroup>
5455

5556
<ItemGroup>
56-
<ProjectReference Include="..\..\Flow.Launcher.Core\Flow.Launcher.Core.csproj" />
57-
<ProjectReference Include="..\..\Flow.Launcher.Infrastructure\Flow.Launcher.Infrastructure.csproj" />
5857
<ProjectReference Include="..\..\Flow.Launcher.Plugin\Flow.Launcher.Plugin.csproj" />
5958
</ItemGroup>
6059

Plugins/Flow.Launcher.Plugin.Explorer/ViewModels/ActionKeywordModel.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@ internal ActionKeywordModel(Settings.ActionKeyword actionKeyword, string descrip
2424

2525
public string Description { get; private init; }
2626

27+
public string LocalizedDescription => Main.Context.API.GetTranslation(Description);
28+
2729
internal Settings.ActionKeyword KeywordProperty { get; }
2830

2931
private void OnPropertyChanged([CallerMemberName] string propertyName = "")

Plugins/Flow.Launcher.Plugin.Explorer/Views/ExplorerSettings.xaml

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
44
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
55
xmlns:converters="clr-namespace:Flow.Launcher.Plugin.Explorer.Views.Converters"
6-
xmlns:core="clr-namespace:Flow.Launcher.Core.Resource;assembly=Flow.Launcher.Core"
76
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
87
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
98
xmlns:qa="clr-namespace:Flow.Launcher.Plugin.Explorer.Search.QuickAccessLinks"
@@ -109,7 +108,7 @@
109108
<TextBlock
110109
Margin="0 5 0 0"
111110
IsEnabled="{Binding Enabled}"
112-
Text="{Binding Description, Mode=OneTime, Converter={StaticResource TranslationConverter}}">
111+
Text="{Binding LocalizedDescription, Mode=OneTime}">
113112
<TextBlock.Style>
114113
<Style TargetType="{x:Type TextBlock}">
115114
<Style.Triggers>
@@ -161,7 +160,6 @@
161160
</Grid>
162161
</DataTemplate>
163162

164-
<core:TranslationConverter x:Key="TranslationConverter" />
165163
<converters:EnumNameConverter x:Key="EnumNameConverter" />
166164
</UserControl.Resources>
167165

@@ -505,7 +503,7 @@
505503
Margin="{StaticResource SettingPanelItemLeftTopBottomMargin}"
506504
Content="{DynamicResource plugin_explorer_previewpanel_display_file_modification_checkbox}"
507505
IsChecked="{Binding ShowModifiedDateInPreviewPanel}" />
508-
506+
509507
<CheckBox
510508
Margin="{StaticResource SettingPanelItemLeftTopBottomMargin}"
511509
Content="{DynamicResource plugin_explorer_previewpanel_display_file_age_checkbox}"

0 commit comments

Comments
 (0)