File tree Expand file tree Collapse file tree 1 file changed +10
-8
lines changed
Plugins/Flow.Launcher.Plugin.Sys Expand file tree Collapse file tree 1 file changed +10
-8
lines changed Original file line number Diff line number Diff line change @@ -84,21 +84,23 @@ public List<Result> Query(Query query)
84
84
85
85
private string GetDynamicTitle ( Query query , Result result )
86
86
{
87
- var pair = KeywordTitleMappings
88
- . Where ( kvp => kvp . Key == result . Title && kvp . Key != kvp . Value )
89
- . FirstOrDefault ( ) ;
90
-
91
- if ( pair . Equals ( default ) )
87
+ if ( ! KeywordTitleMappings . TryGetValue ( result . Title , out var translationKey ) )
92
88
{
93
89
Log . Error ( $ "Dynamic Title not found for: { result . Title } ") ;
94
90
return "Title Not Found" ;
95
91
}
96
92
97
- var translatedTitle = context . API . GetTranslation ( pair . Value ) ;
98
- var englishTitleMatch = StringMatcher . FuzzySearch ( query . Search , pair . Key ) ;
93
+ var translatedTitle = context . API . GetTranslation ( translationKey ) ;
94
+
95
+ if ( result . Title == translatedTitle )
96
+ {
97
+ return result . Title ;
98
+ }
99
+
100
+ var englishTitleMatch = StringMatcher . FuzzySearch ( query . Search , result . Title ) ;
99
101
var translatedTitleMatch = StringMatcher . FuzzySearch ( query . Search , translatedTitle ) ;
100
102
101
- return englishTitleMatch . Score >= translatedTitleMatch . Score ? pair . Key : translatedTitle ;
103
+ return englishTitleMatch . Score >= translatedTitleMatch . Score ? result . Title : translatedTitle ;
102
104
}
103
105
104
106
public void Init ( PluginInitContext context )
You can’t perform that action at this time.
0 commit comments