G文⚡️: Concurrency-safe, Free and Unlimited google translate api for Golang. 🔥免费、无限、并发安全的谷歌翻译包

Googletrans

language Documentation Go Report Card

G文 ⚡️ : Concurrency-safe, free and unlimited golang library that implemented Google Translate API.

Inspired by py-googletrans.

Features

  • Out of the box
  • Auto language detection
  • Customizable service URL

Installation

go get -u github.com/mind1949/googletrans

Usage

Detect language

package main

import (
	"fmt"

	"github.com/mind1949/googletrans"
)

func main() {
	detected, err := googletrans.Detect("hello googletrans")
	if err != nil {
		panic(err)
	}

	format := "language: %q, confidence: %0.2f\n"
	fmt.Printf(format, detected.Lang, detected.Confidence)
}

// Output:
// language: "en", confidence: 1.00

Translate

package main

import (
	"fmt"

	"github.com/mind1949/googletrans"
	"golang.org/x/text/language"
)

func main() {
	params := googletrans.TranslateParams{
		Src:  "auto",
		Dest: language.SimplifiedChinese.String(),
		Text: "Go is an open source programming language that makes it easy to build simple, reliable, and efficient software. ",
	}
	translated, err := googletrans.Translate(params)
	if err != nil {
		panic(err)
	}
	fmt.Printf("text: %q \npronunciation: %q", translated.Text, translated.Pronunciation)
}

// Output:
// text: "Go是一种开放源代码编程语言,可轻松构建简单,可靠且高效的软件。"
// pronunciation: "Go shì yī zhǒng kāifàng yuán dàimǎ biānchéng yǔyán, kě qīngsōng gòujiàn jiǎndān, kěkào qiě gāoxiào de ruǎnjiàn."

Customize service URLs

package main

import "github.com/mind1949/googletrans"

func main() {
	serviceURLs := []string{
		"https://translate.google.com/",
		"https://translate.google.pl/"}
	googletrans.Append(serviceURLs...)
}
Owner
lianjie
🦉A Kill A Day
lianjie
Similar Resources

GoDrive is a Go CLI tool written to wrap the Google Drive API.

GoDrive is a Go CLI tool written to wrap the Google Drive API.

Jan 10, 2022

Simple translation tool using google translation api.

Translator Simple translation tool using google translation api. To use it you have to provide a valid service account as json file with path in the e

Feb 1, 2022

Download tracks with free account

Spotify This module works with Spotify free accounts. It can download individual tracks. It downloads the audio files served by Spotify's servers and

Feb 22, 2022

Simple-Weather-API - Simple weather api app created using golang and Open Weather API key

Simple-Weather-API - Simple weather api app created using golang and Open Weather API key

Simple Weather API Simple weather api app created using golang and Open Weather

Feb 6, 2022

Program to fetch public IP ranges of AWS, Azure and Google

cloudip This program will retrieve a list of all public IP address ranges (v4 or v6) for the three major cloud vendors: Amazon AWS, Microsoft Azure an

Aug 21, 2022

Google Cloud Messaging for application servers implemented using the Go programming language.

gcm The Android SDK provides a nice convenience library (com.google.android.gcm.server) that greatly simplifies the interaction between Java-based app

Sep 27, 2022

Auto-generated Google APIs for Go.

Google APIs Client Library for Go Getting Started $ go get google.golang.org/api/tasks/v1 $ go get google.golang.org/api/moderator/v1 $ go get google.

Jan 8, 2023

Simple Reporting for Google Analytics

##Google analytics Data pull Lightweight Golang library for pulling Google Analytics API data. Built for use with Core Reporting API (v3): https://dev

Sep 27, 2022

Google Cloud Client Libraries for Go.

Google Cloud Client Libraries for Go Go packages for Google Cloud Platform services. import "cloud.google.com/go" To install the packages on your syst

Jan 1, 2023
Comments
  • Concurrent BulkTranslate

    Concurrent BulkTranslate

    • concurrent BulkTranslate
    • previous implementation named as BulkTranslatePipeline
    • covering BulkTranslate with tests (both small and large inputs)
    • benchmarking for BulkTranslate (both small and large inputs)

    This PR is PoC and breaks current API (dependent projects must to be updated). But needed update is very simple, I don't think that it would be very hard to add "Pipeline" in the end of function :) Also I can propose another solution, when concurrent BulkTranslate implementation can be named BulkTranslateConcurrent and save current implementation naming as-is.

    I'm open to your propositions :)

    Also, small TODO list for this PR (add your todos for me here):

    • [ ] Update README
  • BulkTranslate speed

    BulkTranslate speed

    Hey! First of all, thank you for awesome package.

    It's more a question rather than an issue.

    I have a case, when I need to translate near 540 strings at once. There are a lot of info. When I'm trying to translate, it takes near 30-40 seconds to process that all. Questions is, it's related to network/API limitations, or library implementation?

    I found a better way, that just works in my case. Joining strings into one with separator, translating by chunks (to bypass length limits, if any of them exist) and splitting translated text back with the same separator. It takes near 1 second, instead of 30-40.

Translate numbers from numerals to words or roman numerals

Word-Number This package provides a methods for converting numbers to/from various 'word' representations. Currently, that means cardinal and ordinal

May 23, 2022
Correct the timestamp of photo/video of Google Photo from Google takeout

Correct Timestamp of Google Photo from Google Takeout Development Environment: Ubuntu 20.04 Go 1.17 Usage Require Go 1.16 or later to build. go build

Sep 9, 2022
A Wrapper Client for Google Spreadsheet API (Sheets API)

Senmai A Wrapper Client for Google Spreadsheet API (Sheets API) PREPARATION Service Account and Key File Create a service account on Google Cloud Plat

Nov 5, 2021
Hassle-free REST API testing for Go

melatonin melatonin is a fluent, flexible REST API testing library for Go. It provides many of the benefits of a domain-specific test language but wit

Jan 8, 2022
Oneonone - Hassle-free 1on1 meeting questions as API

oneonone Hassle-free 1on1 meeting questions as API API Protobuf IDL Endpoints ht

Oct 21, 2022
DiscSpam is the best free and open source tool to spam/raid Discord servers.
DiscSpam is the best free and open source tool to spam/raid Discord servers.

DiscSpam Fast, Free, Easy to use Discord.com raid tool Report Bug , Request Feature About The Project There are a few Discord raid tools on GitHub, ho

Dec 27, 2022
Google Adwords API for Go

gads Package gads provides a wrapper for the Google Adwords SOAP API. installation go get github.com/emiddleton/gads setup In order to access the API

Sep 27, 2022
Unofficial Google Trends API for Go

Google Trends API for Go Unofficial Google Trends API for Golang gogtrends is API wrapper which allows to get reports from Google Trends. All contribu

Nov 21, 2022
Google Maps API checker
Google Maps API checker

GAP Google API checker. Based on the study Unauthorized Google Maps API Key Usage Cases, and Why You Need to Care and Google Maps API (Not the Key) Bu

Nov 17, 2022
Use Google REST api to extract your personal Photo Library

Photo Go A better approach to extracting your photos from Google to your personal cloud. I'm moving my photos out of Google to a Synology NAS. create

Dec 7, 2021