public HttpResponseMessage Translate(string text, string translate_from, string translate_to) { if (!TranslationAvailable()) { return(new HttpResponseMessage(HttpStatusCode.BadRequest)); } var translator = DictionaryValueTranslatorProvider.GetTranslator(); var translatedText = translator.Translate(text, translate_from, translate_to); return(new HttpResponseMessage() { Content = new StringContent(translatedText) }); }
public bool TranslationAvailable() { return(DictionaryValueTranslatorProvider.GetTranslator() != null); }