Skip to content

Commit c2c403f

Browse files
authored
Merge pull request #6 from vinhtq115/master
Fixed bug
2 parents 6368049 + 9482f21 commit c2c403f

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

src/main/java/com/darkprograms/speech/translator/GoogleTranslate.java

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,14 @@ public static String translate(String sourceLanguage , String targetLanguage , S
154154
if (raw.length < 2) {
155155
return null;
156156
}
157-
return raw[1];//Returns the translation
157+
JSONArray arr = new JSONArray(rawData);
158+
JSONArray arr1 = arr.getJSONArray(0);
159+
StringBuilder trans = new StringBuilder();
160+
for (int i = 0; i < arr1.length(); i++) {
161+
JSONArray arr2 = arr1.getJSONArray(i);
162+
trans.append(arr2.get(0).toString());
163+
}
164+
return trans.toString();//Returns the translation
158165
}
159166

160167
/**

0 commit comments

Comments
 (0)