diff --git a/src/Model/DetectedLanguage.cs b/src/Model/DetectedLanguage.cs new file mode 100644 index 0000000..ab26a13 --- /dev/null +++ b/src/Model/DetectedLanguage.cs @@ -0,0 +1,13 @@ +using Newtonsoft.Json; + +namespace ModernMT.Model +{ + public class DetectedLanguage : Model + { + [JsonProperty("billedCharacters")] + public int BilledCharacters { get; set; } + + [JsonProperty("detectedLanguage")] + public string Language { get; set; } + } +} diff --git a/src/ModernMTService.cs b/src/ModernMTService.cs index 22d395c..fe20a45 100644 --- a/src/ModernMTService.cs +++ b/src/ModernMTService.cs @@ -27,6 +27,17 @@ public List ListSupportedLanguages() return _client.Send>("get", "/translate/languages"); } + public DetectedLanguage DetectLanguage(string q, string format = null) + { + var data = new Dictionary + { + {"q", q}, + {"format", format} + }; + + return _client.Send("get", "/translate/detect", data); + } + public Translation Translate(string source, string target, string q, long[] hints = null, string contextVector = null, TranslateOptions options = null) {