Skip to content

Commit 920162f

Browse files
committed
Use Flow.Launcher.Localization to improve code quality
1 parent 7a7760c commit 920162f

File tree

2 files changed

+10
-5
lines changed

2 files changed

+10
-5
lines changed

Plugins/Flow.Launcher.Plugin.PluginIndicator/Flow.Launcher.Plugin.PluginIndicator.csproj

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
<ErrorReport>prompt</ErrorReport>
3333
<WarningLevel>4</WarningLevel>
3434
<Prefer32Bit>false</Prefer32Bit>
35+
<NoWarn>$(NoWarn);FLSG0007</NoWarn>
3536
</PropertyGroup>
3637

3738
<ItemGroup>
@@ -54,5 +55,9 @@
5455
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
5556
</Content>
5657
</ItemGroup>
58+
59+
<ItemGroup>
60+
<PackageReference Include="Flow.Launcher.Localization" Version="0.0.6" />
61+
</ItemGroup>
5762

5863
</Project>

Plugins/Flow.Launcher.Plugin.PluginIndicator/Main.cs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ namespace Flow.Launcher.Plugin.PluginIndicator
55
{
66
public class Main : IPlugin, IPluginI18n, IHomeQuery
77
{
8-
internal PluginInitContext Context { get; private set; }
8+
internal static PluginInitContext Context { get; private set; }
99

1010
public List<Result> Query(Query query)
1111
{
@@ -34,7 +34,7 @@ from keyword in nonGlobalPlugins.Keys
3434
select new Result
3535
{
3636
Title = keyword,
37-
SubTitle = string.Format(Context.API.GetTranslation("flowlauncher_plugin_pluginindicator_result_subtitle"), plugin.Name),
37+
SubTitle = Localize.flowlauncher_plugin_pluginindicator_result_subtitle(plugin.Name),
3838
Score = score,
3939
IcoPath = plugin.IcoPath,
4040
AutoCompleteText = $"{keyword}{Plugin.Query.TermSeparator}",
@@ -44,7 +44,7 @@ from keyword in nonGlobalPlugins.Keys
4444
return false;
4545
}
4646
};
47-
return results.ToList();
47+
return [.. results];
4848
}
4949

5050
private Dictionary<string, PluginPair> GetNonGlobalPlugins()
@@ -73,12 +73,12 @@ public void Init(PluginInitContext context)
7373

7474
public string GetTranslatedPluginTitle()
7575
{
76-
return Context.API.GetTranslation("flowlauncher_plugin_pluginindicator_plugin_name");
76+
return Localize.flowlauncher_plugin_pluginindicator_plugin_name();
7777
}
7878

7979
public string GetTranslatedPluginDescription()
8080
{
81-
return Context.API.GetTranslation("flowlauncher_plugin_pluginindicator_plugin_description");
81+
return Localize.flowlauncher_plugin_pluginindicator_plugin_description();
8282
}
8383
}
8484
}

0 commit comments

Comments
 (0)