mt

package
v0.0.0-...-be95181 Latest Latest
Warning

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

Go to latest
Published: Aug 25, 2025 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	SuccessResponseCode       = "SUCCESS"
	QueuedTranslatedState     = "QUEUED"
	ProcessingTranslatedState = "PROCESSING"
	FailedTranslatedState     = "FAILED"
	CanceledTranslatedState   = "CANCELED"
	CompletedTranslatedState  = "COMPLETED"
)

Variables

View Source
var TypeByExt = map[string]Type{
	".docx":          DOCX,
	".docm":          DOCM,
	".rtf":           RTF,
	".pptx":          PPTX,
	".xlsx":          XLSX,
	".idml":          IDML,
	".resx":          RESX,
	".txt":           PLAIN_TEXT,
	".xml":           XML,
	".html":          HTML,
	".htm":           HTML,
	".pres":          PRES,
	".srt":           SRT,
	".md":            MARKDOWN,
	".markdown":      MARKDOWN,
	".dita":          DITA,
	".vtt":           VTT,
	".zip":           FLARE,
	".svg":           SVG,
	".xlf":           XLIFF2,
	".xliff":         XLIFF2,
	".csv":           CSV,
	".json":          JSON,
	".xlsx_template": XLSX_TEMPLATE,
}

TypeByExt contains map with FileType by file extension

Functions

This section is empty.

Types

type AccountUID

type AccountUID string

type CancelTranslationResponse

type CancelTranslationResponse struct {
	Code string
}

CancelTranslationResponse defines cancel translation response

type DetectFileLanguageResponse

type DetectFileLanguageResponse struct {
	Code                 string
	LanguageDetectionUID string
}

DetectFileLanguageResponse defines detect file language response

type DetectedSourceLanguage

type DetectedSourceLanguage struct {
	LanguageID      string
	DefaultLocaleID string
}

DetectedSourceLanguage defines detected source language

type DetectionProgressResponse

type DetectionProgressResponse struct {
	Code                    string
	State                   string
	Error                   string
	DetectedSourceLanguages []DetectedSourceLanguage
}

DetectionProgressResponse defines detection progress response

type Downloader

type Downloader interface {
	File(accountUID AccountUID, fileUID FileUID,
		mtUID MtUID, localeID string) (io.Reader, error)
	Batch(accountUID AccountUID, fileUID FileUID, mtUID MtUID) (io.Reader, error)
}

Downloader defines downloader behaviour

func NewDownloader

func NewDownloader(client *smclient.Client) Downloader

NewDownloader returns new Downloader implementation

type ErrorResponse

type ErrorResponse struct {
	Key     string
	Message string
	ErrorID string
}

ErrorResponse defines error response

func (ErrorResponse) IsSet

func (e ErrorResponse) IsSet() bool

IsSet checks if ErrorResponse is set

type FileTranslator

type FileTranslator interface {
	Start(accountUID AccountUID, fileUID FileUID, p StartParams) (StartResponse, error)
	Progress(accountUID AccountUID, fileUID FileUID, mtUID MtUID) (ProgressResponse, error)
}

FileTranslator defines file behaviour

func NewFileTranslator

func NewFileTranslator(client *smclient.Client) FileTranslator

NewFileTranslator returns new FileTranslator implementation

type FileUID

type FileUID string

type LocaleProcessStatusResponse

type LocaleProcessStatusResponse struct {
	LocaleID             string
	State                string
	ProcessedStringCount int
	Error                ErrorResponse
}

LocaleProcessStatusResponse defines locale process status response

type MtUID

type MtUID string

type ProgressResponse

type ProgressResponse struct {
	Code                  string
	State                 string
	RequestedStringCount  int
	Error                 string
	LocaleProcessStatuses []LocaleProcessStatusResponse
}

ProgressResponse defines progress translation response

type StartParams

type StartParams struct {
	SourceLocaleID  string   `json:"sourceLocaleId"`
	TargetLocaleIDs []string `json:"targetLocaleIds"`
}

type StartResponse

type StartResponse struct {
	Code  string
	MtUID MtUID
}

StartResponse defines start translation response

type TranslationControl

type TranslationControl interface {
	CancelTranslation(accountUID AccountUID, fileUID FileUID, mtUID MtUID) (CancelTranslationResponse, error)
	DetectFileLanguage(accountUID AccountUID, fileUID FileUID) (DetectFileLanguageResponse, error)
	DetectionProgress(accountUID AccountUID, fileUID FileUID, languageDetectionUID string) (DetectionProgressResponse, error)
}

TranslationControl defines translation control behaviour

func NewTranslationControl

func NewTranslationControl(client *smclient.Client) TranslationControl

NewTranslationControl returns new TranslationControl implementation

type Type

type Type uint8

Type is type for MT file types

const (
	DOCX Type = iota + 1
	DOCM
	RTF
	PPTX
	XLSX
	IDML
	RESX
	PLAIN_TEXT
	XML
	HTML
	PRES
	SRT
	MARKDOWN
	DITA
	VTT
	FLARE
	SVG
	XLIFF2
	CSV
	JSON
	XLSX_TEMPLATE

	FirstType = DOCX
	LastType  = XLSX_TEMPLATE
)

func (Type) String

func (i Type) String() string

type UploadFileRequest

type UploadFileRequest struct {
	File               []byte
	FileType           Type
	LocalesToAuthorize []string
	Directives         map[string]string
}

UploadFileRequest defines upload file request

type UploadFileResponse

type UploadFileResponse struct {
	Code    string
	FileUID FileUID
}

UploadFileResponse defines upload file response

type Uploader

type Uploader interface {
	UploadFile(accountUID AccountUID, filename string, req UploadFileRequest) (UploadFileResponse, error)
}

Uploader defines uploader behaviour

func NewUploader

func NewUploader(client *smclient.Client) Uploader

NewUploader returns new Uploader implementation

Jump to

Keyboard shortcuts

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