All Projects → hua1995116 → Google Translate Open Api

hua1995116 / Google Translate Open Api

Licence: apache-2.0
A free and unlimited API for Google Translate(support single text and Multi-segment text) 💵🚫

Programming Languages

typescript
32286 projects

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

LMPHP
Multi-language management and support on the site.
Stars: ✭ 19 (-85.61%)
Mutual labels:  translation, translate
Polyglot
🌏 The missing Safari extension that translates selected text into your native language.
Stars: ✭ 387 (+193.18%)
Mutual labels:  translation, translate
whats
🌐 a terminal translation tool
Stars: ✭ 16 (-87.88%)
Mutual labels:  translation, translate
Deep Translator
A flexible free and unlimited python tool to translate between different languages in a simple way using multiple translators.
Stars: ✭ 233 (+76.52%)
Mutual labels:  translation, translate
Google Translate Php
🌐 Free Google Translate API PHP Package. Translates totally free of charge.
Stars: ✭ 1,131 (+756.82%)
Mutual labels:  translation, translate
SimpleTranslationSystem
A simple C# translation system
Stars: ✭ 14 (-89.39%)
Mutual labels:  translation, translate
Translators
🌏🌍🌎Translators🌎🌍🌏 is a library which aims to bring free, multiple, enjoyable translation to individuals and students in Python. Translators是一个旨在用Python为个人和学生带来免费、多样、愉快翻译的库。
Stars: ✭ 295 (+123.48%)
Mutual labels:  translation, translate
React Translated
A dead simple way to add complex translations (i18n) in a React (DOM/Native) project 🌎🌍🌏
Stars: ✭ 176 (+33.33%)
Mutual labels:  translation, translate
React Intl Hooks
React hooks for internationalization without the hassle ⚛️🌍
Stars: ✭ 64 (-51.52%)
Mutual labels:  translation, 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 (+531.82%)
Mutual labels:  translation, translate
Tms
基于频道模式的团队沟通协作+轻量级任务看板,支持mardown、富文本、在线表格和思维导图的团队博文wiki,i18n国际化翻译管理的响应式web开源团队协作系统。
Stars: ✭ 232 (+75.76%)
Mutual labels:  translation, translate
Cyrillic To Translit Js
Ultra-lightweight JavaScript library for converting Cyrillic symbols to Translit and vice versa
Stars: ✭ 91 (-31.06%)
Mutual labels:  translation, translate
Traduzir Paginas Web
Translate your page in real time using Google or Yandex.
Stars: ✭ 214 (+62.12%)
Mutual labels:  translation, translate
pygtrans
谷歌翻译, 支持 APIKEY 一口气翻译十万条
Stars: ✭ 60 (-54.55%)
Mutual labels:  translation, translate
Php Google Translate Free
PHP class to use the Google Translator API for free.
Stars: ✭ 182 (+37.88%)
Mutual labels:  translation, translate
linguist
Linguist is a powerful browser extension for translate pages and text, which are ready to replace your favorite translate service
Stars: ✭ 21 (-84.09%)
Mutual labels:  translation, translate
Deepl Translator
This module provides promised methods for translating text using DeepL Translator (https://www.deepl.com/translator) undocumented API.
Stars: ✭ 145 (+9.85%)
Mutual labels:  translation, translate
Deeply
PHP client for the DeepL.com translation API (unofficial)
Stars: ✭ 152 (+15.15%)
Mutual labels:  translation, translate
Fluent
Fluent — planning, spec and documentation
Stars: ✭ 818 (+519.7%)
Mutual labels:  translation, translate
Androiddeepl
Unofficial Android application of DeepL Translator
Stars: ✭ 86 (-34.85%)
Mutual labels:  translation, translate

google-translate-open-api

A free and unlimited API for Google Translate(support single text and Multi-segment text) 💵🚫

Support me

中文| English

Feature

  • Multi-segment text support
  • Auto language detection
  • Spelling correction
  • Language correction
  • Fast and reliable – it uses the same servers that translate.google.com uses
  • Free and unlimited (translate.google.com uses a token to authorize the requests. If you are not Google, you do not have this token and will have to pay $20 per 1 million characters of text)

Install

npm install --save google-translate-open-api

Why this repo ?

when I have the following sentence. ( from How Are Function Components Different from Classes?)

Maybe you’ve heard one of them is better for performance. Which one? Many of such benchmarks are flawed so I’d be careful drawing conclusions from them.

I don't want to translate all the text first and I'd like to translate segment by segment. Especially in an article, the whole translation may not work well.

1565448193440.jpg

1565516309452.jpg

In the existing library, if I want to translate multi-segment text, I have to request multiple times.(like google-translate-api)

So I have to use the new api to implement, so the google-translate-open-api is born.

Usage

Single segment

import translate from 'google-translate-open-api';
const result = await translate(`I'm fine.`, {
  tld: "cn",
  to: "zh-CN",
});
const data = result.data[0];

// 我很好。

Multi-segment text

import translate from 'google-translate-open-api';

const result = await translate([`I'm fine.`, `I'm ok.`], {
  tld: "cn",
  to: "zh-CN",
});
const data = result.data[0];
// [[[["我很好。"]],null,"en"],[[["我可以。"]],null,"en"]]

Note: Multi-segment text result is different from single sentence. You need extra attention.

Multi-segment text contains mylti-sentence.

import translate, { parseMultiple } from 'google-translate-open-api';

const result = await translate([`I'm fine. And you?`,`I'm ok.`], {
  tld: "cn",
  to: "zh-CN",
});
// [[[[["<i>I&#39;m fine.</i> <b>我很好。</b> <i>And you?</i> <b>你呢?</b>"]],null,"en"],[[["我可以。"]],null,"en"]]]

// use parseMultiple
const data = result.data[0];
const parseData = parseMultiple(data);
// ["我很好。你呢?","我可以。"]

Proxy

proxy-config https://github.com/axios/axios#request-config

const result = await translate([`I'm fine. And you?`,`I'm ok.`], {
  tld: "cn",
  to: "zh-CN",
  proxy: {
    host: '127.0.0.1',
    port: 9000,
    auth: {
      username: 'mikeymike',
      password: 'rapunz3l'
    }
  }
});

Browers

const result = await translate([`I'm fine. And you?`,`I'm ok.`], {
  tld: "cn",
  to: "zh-CN",
  browers: true
});

const data = result.data[0];

// 我很好。

For commonJS

const translate = require('google-translate-open-api').default;

Multi-Terminal Example

https://github.com/hua1995116/google-translate-open-api-demo

API

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 src/languages.ts

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 src/languages.ts.

tld Type: string 'com' | 'cn' <Default 'com'>

cn is for China, com for others.

proxy Type: AxiosProxyConfig

proxy for request.

config Type: object

config for axios

browers Type: boolean

support browers via cors-anywhere (This is a public service, not necessarily stable)

browersUrl Type: string

custom browers proxy url

format Type: string <text|html>

When use single translate, default use text (but we can set it to html) and use batch translate, default and only use html.

Related

Inspiration

License

Apache License

Copyright (c) 2019 蓝色的秋风

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].