crystal-glosbe
Glosbe
Crystal client for Glosbe API
Installation
Add this to your application's shard.yml
:
dependencies:
glosbe:
github: greyblake/crystal-glosbe
Usage
require "glosbe"
client = Glosbe::Client.new
# Translate a word from German to English
response = client.translate("de", "en", "Achtung", tm: true) # => #<Glosbe::TranslateResponse ... >
# Print translations
response.tuc.each do |translation|
puts translation.phrase.try(&.text)
end
# Print examples of usage
response.examples.each do |example|
puts example.first # sentence in German
puts example.second # translation in English
end
Please check Glosbe::Client and Glosbe API for more details.
Errors
Client methods may raise the following errors:
- Glosbe::Error
- Glosbe::HttpError
- Glosbe::ParseError
Running tests
crystal spec
Contributors
- greyblake Sergey Potapov - creator, maintainer
Repository
crystal-glosbe
Owner
Statistic
- 3
- 0
- 0
- 1
- 2
- over 8 years ago
- April 26, 2016
License
MIT License
Links
Synced at
Sun, 22 Dec 2024 19:42:06 GMT
Languages