Skip to content

Commit 4fb17ee

Browse files
committed
Fixed bad respont words
1 parent 9f59aa7 commit 4fb17ee

File tree

1 file changed

+19
-6
lines changed

1 file changed

+19
-6
lines changed

Assets/AutoTranslate/GoogleApiFree/GoogleApiFree.cs

Lines changed: 19 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,12 @@
44
using Newtonsoft.Json.Linq;
55
using System;
66
using System.Collections.Generic;
7+
using System.Diagnostics;
78
using System.Linq;
89
using System.Net;
10+
using System.Reflection;
911
using System.Text;
12+
using UnityEngine.TestTools;
1013

1114
namespace EqualchanceGames.Tools.InterfaceTranslate
1215
{
@@ -108,13 +111,23 @@ public Dictionary<string, string> Translate(Dictionary<string, string> words, st
108111

109112
listRespontWords.AddRange(response.Split(mass, StringSplitOptions.None).ToList());
110113

111-
int index = 0;
112-
foreach (var item in words)
114+
if (listRespontWords.Count != words.Count)
113115
{
114-
targetWords.Add(item.Key, listRespontWords[index]);
115-
++index;
116-
}
117-
116+
foreach (var item in words)
117+
{
118+
targetWords.Add(item.Key, " ");
119+
}
120+
}
121+
else
122+
{
123+
int index = 0;
124+
foreach (var item in words)
125+
{
126+
targetWords.Add(item.Key, listRespontWords[index]);
127+
++index;
128+
}
129+
}
130+
118131
return targetWords;
119132
}
120133

0 commit comments

Comments
 (0)