translate

package
v1.7.0 Latest Latest
Warning

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

Go to latest
Published: Aug 31, 2023 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var File_proto_translate_proto protoreflect.FileDescriptor

Functions

func NewTranslateEndpoints

func NewTranslateEndpoints() []*api.Endpoint

func RegisterTranslateHandler

func RegisterTranslateHandler(s server.Server, hdlr TranslateHandler, opts ...server.HandlerOption) error

Types

type TextRequest

type TextRequest struct {

	// The contents to be translated
	Content string `protobuf:"bytes,1,opt,name=content,proto3" json:"content,omitempty"`
	// Source language, format in ISO-639-1 codes
	// See https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes for more information
	Source string `protobuf:"bytes,2,opt,name=source,proto3" json:"source,omitempty"`
	// Target language, format in ISO-639-1 codes
	// See https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes for more information
	Target string `protobuf:"bytes,3,opt,name=target,proto3" json:"target,omitempty"`
	// The string format, `text` or `html`
	Format string `protobuf:"bytes,4,opt,name=format,proto3" json:"format,omitempty"`
	// The model to use for translation, `nmt` or `base`,
	// See https://cloud.google.com/translate/docs/advanced/translating-text-v3#comparing-models for more information
	Model string `protobuf:"bytes,5,opt,name=model,proto3" json:"model,omitempty"`
	// contains filtered or unexported fields
}

TextRequest is the basic edition request

func (*TextRequest) Descriptor deprecated

func (*TextRequest) Descriptor() ([]byte, []int)

Deprecated: Use TextRequest.ProtoReflect.Descriptor instead.

func (*TextRequest) GetContent

func (x *TextRequest) GetContent() string

func (*TextRequest) GetFormat

func (x *TextRequest) GetFormat() string

func (*TextRequest) GetModel

func (x *TextRequest) GetModel() string

func (*TextRequest) GetSource

func (x *TextRequest) GetSource() string

func (*TextRequest) GetTarget

func (x *TextRequest) GetTarget() string

func (*TextRequest) ProtoMessage

func (*TextRequest) ProtoMessage()

func (*TextRequest) ProtoReflect

func (x *TextRequest) ProtoReflect() protoreflect.Message

func (*TextRequest) Reset

func (x *TextRequest) Reset()

func (*TextRequest) String

func (x *TextRequest) String() string

type TextResponse

type TextResponse struct {
	Translation *Translation `protobuf:"bytes,1,opt,name=translation,proto3" json:"translation,omitempty"`
	// contains filtered or unexported fields
}

TextResponse is the basic edition response

func (*TextResponse) Descriptor deprecated

func (*TextResponse) Descriptor() ([]byte, []int)

Deprecated: Use TextResponse.ProtoReflect.Descriptor instead.

func (*TextResponse) GetTranslation

func (x *TextResponse) GetTranslation() *Translation

func (*TextResponse) ProtoMessage

func (*TextResponse) ProtoMessage()

func (*TextResponse) ProtoReflect

func (x *TextResponse) ProtoReflect() protoreflect.Message

func (*TextResponse) Reset

func (x *TextResponse) Reset()

func (*TextResponse) String

func (x *TextResponse) String() string

type TranslateHandler

type TranslateHandler interface {
	Text(context.Context, *TextRequest, *TextResponse) error
}

type TranslateService

type TranslateService interface {
	Text(ctx context.Context, in *TextRequest, opts ...client.CallOption) (*TextResponse, error)
}

func NewTranslateService

func NewTranslateService(name string, c client.Client) TranslateService

type Translation

type Translation struct {

	// The translation result
	Text string `protobuf:"bytes,1,opt,name=text,proto3" json:"text,omitempty"`
	// The source of the query string
	Source string `protobuf:"bytes,2,opt,name=source,proto3" json:"source,omitempty"`
	// The model used in translation
	Model string `protobuf:"bytes,3,opt,name=model,proto3" json:"model,omitempty"`
	// contains filtered or unexported fields
}

func (*Translation) Descriptor deprecated

func (*Translation) Descriptor() ([]byte, []int)

Deprecated: Use Translation.ProtoReflect.Descriptor instead.

func (*Translation) GetModel

func (x *Translation) GetModel() string

func (*Translation) GetSource

func (x *Translation) GetSource() string

func (*Translation) GetText

func (x *Translation) GetText() string

func (*Translation) ProtoMessage

func (*Translation) ProtoMessage()

func (*Translation) ProtoReflect

func (x *Translation) ProtoReflect() protoreflect.Message

func (*Translation) Reset

func (x *Translation) Reset()

func (*Translation) String

func (x *Translation) String() string

Jump to

Keyboard shortcuts

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