google-translate

Google Translate API bindings

Version on this page:0.4.1
LTS Haskell 10.10:0.4.1
Stackage Nightly 2017-12-24:0.4.1
Latest on Hackage:0.5

See all snapshots google-translate appears in

BSD-3-Clause licensed by David Johnson, Dmitry Dzhus
Maintained by [email protected]
This version can be pinned in stack with:google-translate-0.4.1@sha256:17cc4481670e488720137789b1fe8898bbc2bcbfe1d284076d18f568ddb383a0,1153

Module documentation for 0.4.1

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

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