All Projects → cjrsgu → Google Translate Api Browser

cjrsgu / Google Translate Api Browser

Licence: mit
A free and unlimited API for Google Translate

Programming Languages

typescript
32286 projects

Projects that are alternatives of or similar to Google Translate Api Browser

Deeply
PHP client for the DeepL.com translation API (unofficial)
Stars: ✭ 152 (+58.33%)
Mutual labels:  api, translate
Google Translate Api
A free and unlimited API for Google Translate 💵🚫
Stars: ✭ 1,996 (+1979.17%)
Mutual labels:  api, translate
Trino
Trino: Master your translations with command line!
Stars: ✭ 118 (+22.92%)
Mutual labels:  api, translate
Libretranslate
Free and Open Source Machine Translation API. 100% self-hosted, no limits, no ties to proprietary services. Built on top of Argos Translate.
Stars: ✭ 834 (+768.75%)
Mutual labels:  api, translate
Google Translate
翻译工具 支持网页翻译和文本翻译
Stars: ✭ 356 (+270.83%)
Mutual labels:  api, translate
Google Translate
🈯 A Node.JS library to consume Google Translate API for free.
Stars: ✭ 152 (+58.33%)
Mutual labels:  api, translate
Geeksay
🤓 geeks will ctrl+s the world!
Stars: ✭ 127 (+32.29%)
Mutual labels:  api, translate
Php Google Translate Free
PHP class to use the Google Translator API for free.
Stars: ✭ 182 (+89.58%)
Mutual labels:  api, translate
Mtrans
Multi-source Translation
Stars: ✭ 711 (+640.63%)
Mutual labels:  api, translate
Texterify
The localization management system.
Stars: ✭ 37 (-61.46%)
Mutual labels:  api, translate
Api Client Generator
Angular REST API client generator from Swagger YAML or JSON file with camel case settigs
Stars: ✭ 92 (-4.17%)
Mutual labels:  api
Apipeline
Feature-rich and pluggable offline-first API wrapper for all your javascript environements ! Easily wire-up your API and make your app work offline in minutes.
Stars: ✭ 92 (-4.17%)
Mutual labels:  api
X
新生命X组件,数据中间件XCode、日志、网络、RPC、序列化、缓存、Windows服务
Stars: ✭ 1,322 (+1277.08%)
Mutual labels:  api
Soundcloud
Soundcloud.com API wrapper written in PHP with OAuth2 support.
Stars: ✭ 94 (-2.08%)
Mutual labels:  api
Tpp
Repositório central para organização total (Issues, README's, LICENSE's, etc)
Stars: ✭ 92 (-4.17%)
Mutual labels:  api
Telebot.nim
Async client for Telegram Bot API in pure Nim [Bot API 5.1]
Stars: ✭ 93 (-3.12%)
Mutual labels:  api
Adoc
📄🖊轻松的的 API MD文档编写工具
Stars: ✭ 92 (-4.17%)
Mutual labels:  api
Cyrillic To Translit Js
Ultra-lightweight JavaScript library for converting Cyrillic symbols to Translit and vice versa
Stars: ✭ 91 (-5.21%)
Mutual labels:  translate
Rapidql
Query multiple APIs and DBs and join them in a single query
Stars: ✭ 91 (-5.21%)
Mutual labels:  api
Api Restful Con Laravel Guia Definitiva
Repositorio para el código base del curso "API RESTful con Laravel - Guía Definitiva"
Stars: ✭ 95 (-1.04%)
Mutual labels:  api

Based on google-translate-api and google-translate-token

Install

npm install google-translate-api-browser

or

yarn add google-translate-api-browser

For cross origin requests it uses cors-anywhere . You can use public cors-anywhere server https://cors-anywhere.herokuapp.com/ or set up your own. By default it does not use proxying.

Examples

For browser

import { setCORS } from "google-translate-api-browser";
// setting up cors-anywhere server address
const translate = setCORS("http://cors-anywhere.herokuapp.com/");
/*
// or
import translate, { setCORS } from "google-translate-api-browser";
setCORS("http://cors-anywhere.herokuapp.com/");
*/
translate("Je ne mangé pas six jours", { to: "en" })
  .then(res => {
    // I do not eat six days
    console.log(res.text)
  })
  .catch(err => {
    console.error(err);
  });
};

For node

var { translate } = require("google-translate-api-browser");
var readline = require("readline");

var rl = readline.createInterface(process.stdin, process.stdout);
rl.setPrompt("translate > ");
rl.prompt();

rl.on("line", function(line) {
  translate(line, { to: "en" })
    .then(res => {
      rl.setPrompt(line + " > " + res.text + "\ntranslate > ");
      rl.prompt();
    })
    .catch(err => {
      console.error(err);
    });
}).on("close", function() {
  process.exit(0);
});

API

setCORS(corsServerAddress)

corsServerAddress

Type: string

Address of CORS server for proxying requests to google translate.

Returns a translate function

translate(text, options)

text

Type: string

The text to be translated

options

Type: object

from

Type: string Default: auto

The text language. Must be auto or one of the codes/names (not case sensitive) contained in languages.js

to

Type: string Default: en

The language in which the text should be translated. Must be one of the codes/names (not case sensitive) contained in languages.js.

raw

Type: boolean Default: false

If true, the returned object will have a raw property with the raw response (string) from Google Translate.

Returns an object:

  • text (string) – The translated text.
  • from (object)
    • language (object)
      • didYouMean (boolean) - true if the API suggest a correction in the source language
      • iso (string) - The code of the language that the API has recognized in the text
    • text (object)
      • autoCorrected (boolean)true if the API has auto corrected the text
      • value (string) – The auto corrected text or the text with suggested corrections
      • didYouMean (boolean)true if the API has suggested corrections to the text
  • raw (string) - If options.raw is true, the raw response from Google Translate servers. Otherwise, ''.

Note that res.from.text will only be returned if from.text.autoCorrected or from.text.didYouMean equals to true. In this case, it will have the corrections delimited with brackets ([ ]):

translate("I spea Dutch")
  .then(res => {
    console.log(res.from.text.value);
    //=> I [speak] Dutch
  })
  .catch(err => {
    console.error(err);
  });
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].