Documentation
¶
Index ¶
- Constants
- Variables
- func ErrEmptyParam(name string) error
- func IsErrEmptyParam(err error) bool
- type AccountUID
- type CancelTranslationResponse
- type DetectFileLanguageResponse
- type DetectedSourceLanguage
- type DetectionProgressResponse
- type Downloader
- type ErrorResponse
- type FileTranslator
- type FileUID
- type LocaleProcessStatusResponse
- type MtUID
- type ProgressResponse
- type StartParams
- type StartResponse
- type TranslationControl
- type Type
- type UploadFileRequest
- type UploadFileResponse
- type Uploader
Constants ¶
const ( SuccessResponseCode = "SUCCESS" QueuedTranslatedState = "QUEUED" ProcessingTranslatedState = "PROCESSING" FailedTranslatedState = "FAILED" CanceledTranslatedState = "CANCELED" CompletedTranslatedState = "COMPLETED" )
Variables ¶
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 ¶
func ErrEmptyParam ¶
ErrEmptyParam creates a new empty param error
func IsErrEmptyParam ¶
IsErrEmptyParam checks if error is errEmptyParam
Types ¶
type AccountUID ¶
type AccountUID string
func (AccountUID) Validate ¶
func (a AccountUID) Validate() error
type CancelTranslationResponse ¶
type CancelTranslationResponse struct {
Code string
}
CancelTranslationResponse defines cancel translation response
type DetectFileLanguageResponse ¶
DetectFileLanguageResponse defines detect file language response
type DetectedSourceLanguage ¶
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.ReadCloser, error)
}
Downloader defines downloader behaviour
func NewDownloader ¶
func NewDownloader(client *smclient.Client) Downloader
NewDownloader returns new Downloader implementation
type ErrorResponse ¶
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 LocaleProcessStatusResponse ¶
type LocaleProcessStatusResponse struct {
LocaleID string
State string
ProcessedStringCount int
Error ErrorResponse
}
LocaleProcessStatusResponse defines locale process status response
type ProgressResponse ¶
type ProgressResponse struct {
Code string
State string
RequestedStringCount int
Error string
LocaleProcessStatuses []LocaleProcessStatusResponse
}
ProgressResponse defines progress translation response
type StartParams ¶
type StartResponse ¶
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 )
type UploadFileRequest ¶
type UploadFileRequest struct {
File []byte
FileType Type
LocalesToAuthorize []string
Directives map[string]string
}
UploadFileRequest defines upload file request
type UploadFileResponse ¶
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