Skip to content

Commit

Permalink
Fix language detection support for array query
Browse files Browse the repository at this point in the history
  • Loading branch information
davc0n committed Aug 23, 2022
1 parent 4ce898a commit bb1f97f
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/ModernMTService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,19 @@ public List<string> ListSupportedLanguages()
}

public DetectedLanguage DetectLanguage(string q, string format = null)
{
return DetectLanguage(new List<string> {q}, format)[0];
}

public List<DetectedLanguage> DetectLanguage(List<string> q, string format = null)
{
var data = new Dictionary<string, dynamic>
{
{"q", q},
{"q", q.ToArray()},
{"format", format}
};

return _client.Send<DetectedLanguage>("get", "/translate/detect", data);
return _client.Send<List<DetectedLanguage>>("get", "/translate/detect", data);
}

public Translation Translate(string source, string target, string q, long[] hints = null,
Expand Down

0 comments on commit bb1f97f

Please sign in to comment.