Skip to content

Commit f064a81

Browse files
Merge branch 'dev' into double-pin
2 parents d2dc307 + 40e5c04 commit f064a81

File tree

29 files changed

+535
-345
lines changed

29 files changed

+535
-345
lines changed

.github/actions/spelling/expect.txt

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# This file should contain names of products, companies, or individuals that aren't in a standard dictionary (e.g., GitHub, Keptn, VSCode).
2+
13
crowdin
24
DWM
35
workflows
@@ -34,7 +36,6 @@ mscorlib
3436
pythonw
3537
dotnet
3638
winget
37-
jjw24
3839
wolframalpha
3940
gmail
4041
duckduckgo
@@ -49,15 +50,13 @@ srchadmin
4950
EWX
5051
dlgtext
5152
CMD
52-
appref-ms
5353
appref
5454
TSource
5555
runas
5656
dpi
5757
popup
5858
ptr
5959
pluginindicator
60-
TobiasSekan
6160
img
6261
resx
6362
bak
@@ -68,9 +67,6 @@ dlg
6867
ddd
6968
dddd
7069
clearlogfolder
71-
ACCENT_ENABLE_TRANSPARENTGRADIENT
72-
ACCENT_ENABLE_BLURBEHIND
73-
WCA_ACCENT_POLICY
7470
HGlobal
7571
dopusrt
7672
firefox
@@ -91,22 +87,15 @@ keyevent
9187
KListener
9288
requery
9389
vkcode
94-
čeština
9590
Polski
9691
Srpski
97-
Português
98-
Português (Brasil)
9992
Italiano
100-
Slovenský
10193
quicklook
102-
Tiếng Việt
10394
Droplex
10495
Preinstalled
10596
errormetadatafile
10697
noresult
10798
pluginsmanager
10899
alreadyexists
109-
JsonRPC
110-
JsonRPCV2
111100
Softpedia
112101
img

.github/actions/spelling/patterns.txt

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
# See https://github.com/check-spelling/check-spelling/wiki/Configuration-Examples:-patterns
2+
# This file should contain strings that contain a mix of letters and numbers, or specific symbols
3+
24

35
# Questionably acceptable forms of `in to`
46
# Personally, I prefer `log into`, but people object
@@ -121,3 +123,13 @@
121123

122124
# version suffix <word>v#
123125
(?:(?<=[A-Z]{2})V|(?<=[a-z]{2}|[A-Z]{2})v)\d+(?:\b|(?=[a-zA-Z_]))
126+
127+
\bjjw24\b
128+
\bappref-ms\b
129+
\bTobiasSekan\b
130+
\bJsonRPC\b
131+
\bJsonRPCV2\b
132+
\bTiếng Việt\b
133+
\bPortuguês (Brasil)\b
134+
\bčeština\b
135+
\bPortuguês\b

Flow.Launcher.Core/Resource/Internationalization.cs

Lines changed: 30 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,17 @@
11
using System;
22
using System.Collections.Generic;
3+
using System.Globalization;
34
using System.IO;
45
using System.Linq;
56
using System.Reflection;
7+
using System.Threading;
8+
using System.Threading.Tasks;
69
using System.Windows;
10+
using CommunityToolkit.Mvvm.DependencyInjection;
711
using Flow.Launcher.Core.Plugin;
812
using Flow.Launcher.Infrastructure;
913
using Flow.Launcher.Infrastructure.UserSettings;
1014
using Flow.Launcher.Plugin;
11-
using System.Globalization;
12-
using System.Threading.Tasks;
13-
using CommunityToolkit.Mvvm.DependencyInjection;
1415

1516
namespace Flow.Launcher.Core.Resource
1617
{
@@ -29,13 +30,12 @@ public class Internationalization
2930
private readonly Settings _settings;
3031
private readonly List<string> _languageDirectories = new();
3132
private readonly List<ResourceDictionary> _oldResources = new();
32-
private readonly string SystemLanguageCode;
33+
private static string SystemLanguageCode;
3334

3435
public Internationalization(Settings settings)
3536
{
3637
_settings = settings;
3738
AddFlowLauncherLanguageDirectory();
38-
SystemLanguageCode = GetSystemLanguageCodeAtStartup();
3939
}
4040

4141
private void AddFlowLauncherLanguageDirectory()
@@ -44,7 +44,7 @@ private void AddFlowLauncherLanguageDirectory()
4444
_languageDirectories.Add(directory);
4545
}
4646

47-
private static string GetSystemLanguageCodeAtStartup()
47+
public static void InitSystemLanguageCode()
4848
{
4949
var availableLanguages = AvailableLanguages.GetAvailableLanguages();
5050

@@ -65,11 +65,11 @@ private static string GetSystemLanguageCodeAtStartup()
6565
string.Equals(languageCode, threeLetterCode, StringComparison.OrdinalIgnoreCase) ||
6666
string.Equals(languageCode, fullName, StringComparison.OrdinalIgnoreCase))
6767
{
68-
return languageCode;
68+
SystemLanguageCode = languageCode;
6969
}
7070
}
7171

72-
return DefaultLanguageCode;
72+
SystemLanguageCode = DefaultLanguageCode;
7373
}
7474

7575
private void AddPluginLanguageDirectories()
@@ -173,15 +173,33 @@ private async Task ChangeLanguageAsync(Language language)
173173
LoadLanguage(language);
174174
}
175175

176-
// Culture of main thread
177-
// Use CreateSpecificCulture to preserve possible user-override settings in Windows, if Flow's language culture is the same as Windows's
178-
CultureInfo.CurrentCulture = CultureInfo.CreateSpecificCulture(language.LanguageCode);
179-
CultureInfo.CurrentUICulture = CultureInfo.CurrentCulture;
176+
// Change culture info
177+
ChangeCultureInfo(language.LanguageCode);
180178

181179
// Raise event for plugins after culture is set
182180
await Task.Run(UpdatePluginMetadataTranslations);
183181
}
184182

183+
public static void ChangeCultureInfo(string languageCode)
184+
{
185+
// Culture of main thread
186+
// Use CreateSpecificCulture to preserve possible user-override settings in Windows, if Flow's language culture is the same as Windows's
187+
CultureInfo currentCulture;
188+
try
189+
{
190+
currentCulture = CultureInfo.CreateSpecificCulture(languageCode);
191+
}
192+
catch (CultureNotFoundException)
193+
{
194+
currentCulture = CultureInfo.CreateSpecificCulture(SystemLanguageCode);
195+
}
196+
CultureInfo.CurrentCulture = currentCulture;
197+
CultureInfo.CurrentUICulture = currentCulture;
198+
var thread = Thread.CurrentThread;
199+
thread.CurrentCulture = currentCulture;
200+
thread.CurrentUICulture = currentCulture;
201+
}
202+
185203
public bool PromptShouldUsePinyin(string languageCodeToSet)
186204
{
187205
var languageToSet = GetLanguageByLanguageCode(languageCodeToSet);

Flow.Launcher.Infrastructure/UserSettings/Settings.cs

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,13 @@ public void SetStorage(FlowLauncherJsonStorage<Settings> storage)
2525

2626
public void Initialize()
2727
{
28+
// Initialize dependency injection instances after Ioc.Default is created
2829
_stringMatcher = Ioc.Default.GetRequiredService<StringMatcher>();
30+
31+
// Initialize application resources after application is created
32+
var settingWindowFont = new FontFamily(SettingWindowFont);
33+
Application.Current.Resources["SettingWindowFont"] = settingWindowFont;
34+
Application.Current.Resources["ContentControlThemeFontFamily"] = settingWindowFont;
2935
}
3036

3137
public void Save()
@@ -119,8 +125,11 @@ public string SettingWindowFont
119125
{
120126
_settingWindowFont = value;
121127
OnPropertyChanged();
122-
Application.Current.Resources["SettingWindowFont"] = new FontFamily(value);
123-
Application.Current.Resources["ContentControlThemeFontFamily"] = new FontFamily(value);
128+
if (Application.Current != null)
129+
{
130+
Application.Current.Resources["SettingWindowFont"] = new FontFamily(value);
131+
Application.Current.Resources["ContentControlThemeFontFamily"] = new FontFamily(value);
132+
}
124133
}
125134
}
126135
}
@@ -411,7 +420,7 @@ public bool HideNotifyIcon
411420
public bool LeaveCmdOpen { get; set; }
412421
public bool HideWhenDeactivated { get; set; } = true;
413422

414-
private bool _showAtTopmost = true;
423+
private bool _showAtTopmost = false;
415424
public bool ShowAtTopmost
416425
{
417426
get => _showAtTopmost;

Flow.Launcher.Plugin/Flow.Launcher.Plugin.csproj

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,10 @@
1414
</PropertyGroup>
1515

1616
<PropertyGroup>
17-
<Version>4.5.0</Version>
18-
<PackageVersion>4.5.0</PackageVersion>
19-
<AssemblyVersion>4.5.0</AssemblyVersion>
20-
<FileVersion>4.5.0</FileVersion>
17+
<Version>4.6.0</Version>
18+
<PackageVersion>4.6.0</PackageVersion>
19+
<AssemblyVersion>4.6.0</AssemblyVersion>
20+
<FileVersion>4.6.0</FileVersion>
2121
<PackageId>Flow.Launcher.Plugin</PackageId>
2222
<Authors>Flow-Launcher</Authors>
2323
<PackageLicenseExpression>MIT</PackageLicenseExpression>

Flow.Launcher.Plugin/Interfaces/IPublicAPI.cs

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -336,13 +336,28 @@ public interface IPublicAPI
336336
public void OpenDirectory(string DirectoryPath, string FileNameOrFilePath = null);
337337

338338
/// <summary>
339-
/// Opens the URL with the given Uri object.
339+
/// Opens the URL using the browser with the given Uri object, even if the URL is a local file.
340+
/// The browser and mode used is based on what's configured in Flow's default browser settings.
341+
/// </summary>
342+
public void OpenWebUrl(Uri url, bool? inPrivate = null);
343+
344+
/// <summary>
345+
/// Opens the URL using the browser with the given string, even if the URL is a local file.
346+
/// The browser and mode used is based on what's configured in Flow's default browser settings.
347+
/// Non-C# plugins should use this method.
348+
/// </summary>
349+
public void OpenWebUrl(string url, bool? inPrivate = null);
350+
351+
/// <summary>
352+
/// Opens the URL with the given Uri object in browser if scheme is Http or Https.
353+
/// If the URL is a local file, it will instead be opened with the default application for that file type.
340354
/// The browser and mode used is based on what's configured in Flow's default browser settings.
341355
/// </summary>
342356
public void OpenUrl(Uri url, bool? inPrivate = null);
343357

344358
/// <summary>
345-
/// Opens the URL with the given string.
359+
/// Opens the URL with the given string in browser if scheme is Http or Https.
360+
/// If the URL is a local file, it will instead be opened with the default application for that file type.
346361
/// The browser and mode used is based on what's configured in Flow's default browser settings.
347362
/// Non-C# plugins should use this method.
348363
/// </summary>

0 commit comments

Comments
 (0)