Skip to content

Commit 5434b1c

Browse files
Only convert to double pinyin when meeting Chinese
1 parent 50f8d56 commit 5434b1c

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

Flow.Launcher.Infrastructure/DoublePinAlphabet.cs

+4-3
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ public bool CanBeTranslated(string stringToTranslate)
4747
{
4848
if (WordsHelper.HasChinese(content))
4949
{
50-
var resultList = WordsHelper.GetPinyinList(content).Select(ToDoublePin).ToArray();
50+
var resultList = WordsHelper.GetPinyinList(content);
5151
StringBuilder resultBuilder = new StringBuilder();
5252
TranslationMapping map = new TranslationMapping();
5353

@@ -57,9 +57,10 @@ public bool CanBeTranslated(string stringToTranslate)
5757
{
5858
if (content[i] >= 0x3400 && content[i] <= 0x9FD5)
5959
{
60-
map.AddNewIndex(i, resultBuilder.Length, resultList[i].Length + 1);
60+
string dp = ToDoublePin(resultList[i].ToLower());
61+
map.AddNewIndex(i, resultBuilder.Length, dp.Length + 1);
6162
resultBuilder.Append(' ');
62-
resultBuilder.Append(resultList[i]);
63+
resultBuilder.Append(dp);
6364
pre = true;
6465
}
6566
else

0 commit comments

Comments
 (0)