deepleng

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Jan 19, 2022 License: MIT Imports: 6 Imported by: 0

README

deepleng

import "github.com/Qithub-BOT/QiiTrans/src/engines/deepleng"

Package deepleng は DeepL の翻訳 API を使った翻訳エンジンです.

このエンジンを利用するには、DeepL PRO の無料/有料アカウントから発行したアクセス・トークン(認証キー/API キー)が必要です。

- アカウント登録後のアクセス・トークン確認先: https://www.deepl.com/pro-account/plan (認証キー)

Index

Constants

NameVarEnvAPIKey は環境変数の変数名で、DeepL の認証キー(アクセストークン)用の変数名です.

const NameVarEnvAPIKey = "DEEPL_API_KEY"

func GetInfoAPI

func GetInfoAPI(p *engine.Properties) (engine.AccountInfo, error)

GetInfoAPI はアクセス・トークンのアカウント情報のうち、engine.AccountInfo に必要なものだけセットして返します.

func GetURLBaseAPI

func GetURLBaseAPI(p *engine.Properties) string

GetURLBaseAPI は DeepL の翻訳 API のエンドポイントのドメインを返します. 無料・有料アカウントでドメインは異なるため、アクセス・トークン(認証キー)から自動検知して返します.

func IsAPIKeyFree

func IsAPIKeyFree(apikey string) bool

IsAPIKeyFree は apikey が無料枠のアクセストークンか返します.

func New

func New(cacheID ...string) *engine.Properties

New は翻訳エンジン(DeepL)の新規インスタンスのポインタを返します.

func Translate

func Translate(p *engine.Properties, inText string, langFrom string, langTo string) (result string, err error)

Translate は inText を langFrom から langTo に DeepL の翻訳 API を使って翻訳した結果を返します.

この関数は結果をキャッシュしません。別途、呼び出し元でキャッシュを行ってください.


Generated by gomarkdoc

Documentation

Overview

Package deepleng は DeepL の翻訳 API を使った翻訳エンジンです.

このエンジンを利用するには、DeepL PRO の無料/有料アカウントから発行したアクセス・トークン(認証キー/API キー)が必要です。

- アカウント登録後のアクセス・トークン確認先: https://www.deepl.com/pro-account/plan (認証キー)

Index

Constants

View Source
const NameVarEnvAPIKey = "DEEPL_API_KEY"

NameVarEnvAPIKey は環境変数の変数名で、DeepL の認証キー(アクセストークン)用の変数名です.

Variables

This section is empty.

Functions

func GetInfoAPI

func GetInfoAPI(p *engine.Properties) (engine.AccountInfo, error)

GetInfoAPI はアクセス・トークンのアカウント情報のうち、engine.AccountInfo に必要なものだけセットして返します.

func GetURLBaseAPI

func GetURLBaseAPI(p *engine.Properties) string

GetURLBaseAPI は DeepL の翻訳 API のエンドポイントのドメインを返します. 無料・有料アカウントでドメインは異なるため、アクセス・トークン(認証キー)から自動検知して返します.

func IsAPIKeyFree

func IsAPIKeyFree(apikey string) bool

IsAPIKeyFree は apikey が無料枠のアクセストークンか返します.

func New

func New(cacheID ...string) *engine.Properties

New は翻訳エンジン(DeepL)の新規インスタンスのポインタを返します.

func Translate

func Translate(p *engine.Properties, inText string, langFrom string, langTo string) (result string, err error)

Translate は inText を langFrom から langTo に DeepL の翻訳 API を使って翻訳した結果を返します.

この関数は結果をキャッシュしません。別途、呼び出し元でキャッシュを行ってください.

Types

This section is empty.

Jump to

Keyboard shortcuts

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