crystal-google_translate
forked from greyblake/crystal-google_translateCrystal GoogleTranslate
Crystal client for GoogleTranslate
Installation
Add this to your application's shard.yml
:
dependencies:
google_translate:
github: greyblake/crystal-google_translate
Usage
require "google_translate"
Example
The following code translates german word tanzen
with a typo(double n) and prints the result:
client = GoogleTranslate::Client.new
tr = client.translate("de", "en", "tanzenn")
puts "#{tr.source_lang} -> #{tr.target_lang}"
puts "Query: #{tr.query}"
puts "Corrected query: #{tr.corrected_query}"
puts "Text: #{tr.text}"
tr.variants.each do |word_class, words|
puts word_class
words.each do |word|
puts " #{word}"
end
end
Output:
de -> en
Query: tanzenn
Corrected query: tanzen
Text: dance
verb
dance
hop
spin
bob
foot
Development
To run specs:
crystal spec
Contributors
- greyblake Sergey Potapov - creator, maintainer
Repository
crystal-google_translate
Owner
Statistic
- 1
- 0
- 0
- 1
- 2
- over 6 years ago
- February 8, 2018
License
MIT License
Links
Synced at
Thu, 07 Nov 2024 16:03:40 GMT
Languages