Skip to content

Latest commit

 

History

2 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Glosbe API wrapper

Translate from any language to any language using the free and awesome Glosbe API service. See: https://glosbe.com/

Usage

Installation

composer require subzeta/glosbe

Translate

<?php 

use subzeta\Glosbe\Translator;

$response = (new Translator())->translate('music', 'eng', 'spa')->send();
var_dump($response->translations());
var_dump($response->meanings());

Options

Including examples in the response

Looking for examples? Just request it before sending the request.

<?php 

use subzeta\Glosbe\Translator;

$response = (new Translator())->translate('music', 'eng', 'spa')->includingExamples()->send();
var_dump($response->translations());
var_dump($response->meanings());
var_dump($response->examples());

Notes

To do

  • Detect a bad formatted language ISO code (specially ISO 639-1) and translate to its 639-3 equivalent. As Glosbe points out, the API may understand a two letter code but it's better to provide it as the API expects it.
  • Support for multi-translations (more than one text) and more than one translatable-language (more than one "to"). By now Glosbe doesn't support it.
  • Add the addTranslation method, request and response.
  • Limit the number of translations on response build (an option for that would be nice).

License

MIT

About

Glosbe API wrapper

Resources

Stars

5 stars

Watchers

2 watching

Forks

Releases

Packages

Contributors

Languages