Skip to content

Commit 4ebfba7

Browse files
committed
using ContainKey instead of getvalueofdefault
1 parent c4b81a9 commit 4ebfba7

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

Flow.Launcher.Infrastructure/Alphabet.cs

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -32,21 +32,20 @@ public string Translate(string content)
3232
{
3333
if (_settings.ShouldUsePinyin)
3434
{
35-
string result = _pinyinCache.GetValueOrDefault(content);
36-
if (result == null)
35+
if (_pinyinCache.ContainsKey(content))
3736
{
3837
if (WordsHelper.HasChinese(content))
3938
{
40-
result = WordsHelper.GetPinyin(content,";");
39+
var result = WordsHelper.GetPinyin(content,";");
4140
result = GetFirstPinyinChar(result) + result.Replace(";","");
4241
_pinyinCache[content] = result;
42+
return result;
4343
}
4444
else
4545
{
46-
result = content;
46+
return content;
4747
}
4848
}
49-
return result;
5049
}
5150
else
5251
{

0 commit comments

Comments
 (0)