google-translate

Google Translate API bindings

Version on this page:0.3
LTS Haskell 8.5:0.3
Stackage Nightly 2017-02-11:0.3
Latest on Hackage:0.4
BSD3 licensed by David Johnson, Dmitry Dzhus
Maintained by djohnson.m@gmail.com

Module documentation for 0.3

google-translate

Hackage Hackage Dependencies Haskell Programming Language BSD3 License Build Status

High-level, up-to-date bindings to the Google Translate API.

{-# LANGUAGE OverloadedStrings #-}
import Control.Monad
import qualified Data.Text.IO as T
import Network.HTTP.Client
import Network.HTTP.Client.TLS
import Web.Google.Translate

main :: IO ()
main = do
  Right TranslationResponse { translations = xs } <-
    newManager tlsManagerSettings >>= \mgr ->
    translate mgr (Key "<API-Key>") (Just srcLang) trgLang (Body "Hello")
  forM_ xs $ \Translation { translatedText = TranslatedText txt } ->
    T.putStrLn txt
  where
    srcLang = Source English
    trgLang = Target Russian

-- >>> Здравствуйте
comments powered byDisqus