Skip to content

Commit b31a740

Browse files
Simple refactor
1 parent fba42ff commit b31a740

File tree

1 file changed

+6
-12
lines changed

1 file changed

+6
-12
lines changed

Flow.Launcher.Infrastructure/PinyinAlphabet.cs

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -30,18 +30,12 @@ public bool ShouldTranslate(string stringToTranslate)
3030

3131
public (string translation, TranslationMapping map) Translate(string content)
3232
{
33-
if (_settings.ShouldUsePinyin)
34-
{
35-
if (true)
36-
{
37-
return BuildCacheFromContent(content);
38-
}
39-
//else
40-
//{
41-
// return value;
42-
//}
43-
}
44-
return (content, null);
33+
if (!_settings.ShouldUsePinyin)
34+
return (content, null);
35+
36+
return _pinyinCache.TryGetValue(content, out var value)
37+
? value
38+
: BuildCacheFromContent(content);
4539
}
4640

4741
private (string translation, TranslationMapping map) BuildCacheFromContent(string content)

0 commit comments

Comments
 (0)