@@ -25,9 +25,6 @@ public class Internationalization
25
25
26
26
public Internationalization ( )
27
27
{
28
- LoadDefaultLanguage ( ) ;
29
- // we don't want to load /Languages/en.xaml twice
30
- // so add flowlauncher language directory after load plugin language files
31
28
AddFlowLauncherLanguageDirectory ( ) ;
32
29
}
33
30
@@ -39,9 +36,9 @@ private void AddFlowLauncherLanguageDirectory()
39
36
}
40
37
41
38
42
- internal void AddPluginLanguageDirectories ( )
39
+ internal void AddPluginLanguageDirectories ( IEnumerable < PluginPair > plugins )
43
40
{
44
- foreach ( var plugin in PluginManager . GetPluginsForInterface < IPluginI18n > ( ) )
41
+ foreach ( var plugin in plugins )
45
42
{
46
43
var location = Assembly . GetAssembly ( plugin . Plugin . GetType ( ) ) . Location ;
47
44
var dir = Path . GetDirectoryName ( location ) ;
@@ -55,6 +52,8 @@ internal void AddPluginLanguageDirectories()
55
52
Log . Error ( $ "|Internationalization.AddPluginLanguageDirectories|Can't find plugin path <{ location } > for <{ plugin . Metadata . Name } >") ;
56
53
}
57
54
}
55
+
56
+ LoadDefaultLanguage ( ) ;
58
57
}
59
58
60
59
private void LoadDefaultLanguage ( )
@@ -139,11 +138,14 @@ private void RemoveOldLanguageFiles()
139
138
140
139
private void LoadLanguage ( Language language )
141
140
{
141
+ var flowEnglishFile = Path . Combine ( Constant . ProgramDirectory , Folder , DefaultFile ) ;
142
142
var dicts = Application . Current . Resources . MergedDictionaries ;
143
143
var filename = $ "{ language . LanguageCode } { Extension } ";
144
144
var files = _languageDirectories
145
145
. Select ( d => LanguageFile ( d , filename ) )
146
- . Where ( f => ! string . IsNullOrEmpty ( f ) )
146
+ // Exclude Flow's English language file since it's built into the binary, and there's no need to load
147
+ // it again from the file system.
148
+ . Where ( f => ! string . IsNullOrEmpty ( f ) && f != flowEnglishFile )
147
149
. ToArray ( ) ;
148
150
149
151
if ( files . Length > 0 )
0 commit comments