translate

package
v1.0.4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 27, 2023 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Overview

Package translate implements translation on Google Translate.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Language

type Language struct {
	Language string
	Name     string
}

Language represents a supported language with language code and name.

func Languages

func Languages(target string, key string) ([]Language, error)

Languages returns the list of supported Google Translate languages for a given target language or empty string for all supported languages.

type Translation

type Translation struct {
	TranslatedText         string
	DetectedSourceLanguage string
}

Translation represents a result with text and detected source language.

func Translate

func Translate(source, target, text, key string) (*Translation, error)

Translate translates a text on Google Translate from a language to another. It requires a Google API Key (key), valid source and target languages. For automatic source language detection, use empty string.

Directories

Path Synopsis
Google Translate client.
Google Translate client.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL