batches

package
v0.0.0-...-c0e20a5 Latest Latest
Warning

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

Go to latest
Published: Nov 21, 2025 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// ReuseExistingMode is reuse existing mode
	ReuseExistingMode = "REUSE_EXISTING"
	// RandomAlphanumericSalt is random alphanumeric salt
	RandomAlphanumericSalt = "RANDOM_ALPHANUMERIC"
)

Variables

View Source
var TypeByExt = map[string]Type{
	".properties":  JAVA_PROPERTIES,
	".strings":     IOS,
	".stringsdict": STRINGSDICT,
	".po":          GETTEXT,
	".pot":         GETTEXT,
	".php":         PHP_RESOURCE,
	".resx":        RESX,
	".resw":        RESX,
	".xlf":         XLIFF,
	".xliff":       XLIFF,
	".yml":         YAML,
	".yaml":        YAML,
	".json":        JSON,
	".js":          JSON,
	".xml":         XML,
	".html":        HTML,
	".htm":         HTML,
	".docx":        DOCX,
	".pptx":        PPTX,
	".xlsx":        XLSX,
	".idml":        IDML,
	".xls":         XLS,
	".doc":         DOC,
	".ts":          QT,
	".csv":         CSV,
	".tmx":         TMX,
	".txt":         PLAIN_TEXT,
	".ppt":         PPT,
	".pres":        PRES,
	".srt":         SRT,
	".markdown":    MARKDOWN,
	".md":          MARKDOWN,
	".dita":        DITA,
	".ditamap":     DITA,
	".zip":         DITA_ZIP,
	".vtt":         VTT,
	".pdf":         PDF,
	".rtf":         RTF,
	".flprjzip":    FLARE,
	".ftl":         FLUENT,
	".svg":         SVG,
	".docm":        DOCM,
	".arb":         ARB,
	".indd":        INDD,
	".xcstrings":   XCSTRINGS,
	".vsdx":        VSDX,
	".vsdm":        VSDM,
}

Functions

This section is empty.

Types

type Batch

type Batch interface {
	Create(projectID string, payload CreateBatchPayload) (CreateBatchResponse, error)
	CreateJob(projectID string, payload CreateJobPayload) (CreateJobResponse, error)
	UploadFile(ctx context.Context, projectID, batchUID string, payload UploadFilePayload) (UploadFileResponse, error)
	GetStatus(projectID, batchUID string) (GetStatusResponse, error)
}

Batch defines the batch behaviour

func NewBatch

func NewBatch(client *smclient.Client) Batch

NewBatch returns new Batch implementation

type CreateBatchPayload

type CreateBatchPayload struct {
	Authorize         bool             `json:"authorize"`
	TranslationJobUID string           `json:"translationJobUid"`
	FileUris          []string         `json:"fileUris"`
	LocaleWorkflows   []LocaleWorkflow `json:"localeWorkflows"`
}

CreateBatchPayload defines create batch payload

type CreateBatchResponse

type CreateBatchResponse struct {
	Code     string
	BatchUID string
}

CreateBatchResponse defines create batch response

type CreateJobPayload

type CreateJobPayload struct {
	NameTemplate    string   `json:"nameTemplate"`
	Description     string   `json:"description"`
	TargetLocaleIds []string `json:"targetLocaleIds"`
	Mode            string   `json:"mode"`
	Salt            string   `json:"salt"`
	TimeZoneName    string   `json:"timeZoneName"`
}

CreateJobPayload defines create job payload

type CreateJobResponse

type CreateJobResponse struct {
	Code              string
	TranslationJobUID string
	JobName           string
	JobNumber         string
	TargetLocaleIDs   []string
	Description       string
	JobStatus         string
}

CreateJobResponse defines create job response

type GetStatusFile

type GetStatusFile struct {
	Errors        string
	FileUri       string
	Status        string
	TargetLocales []TargetLocale
	UpdatedDate   time.Time
}

GetStatusFile defines file status in get status response

type GetStatusResponse

type GetStatusResponse struct {
	Code              string
	Authorized        bool
	GeneralErrors     string
	ProjectID         string
	Status            string
	TranslationJobUID string
	UpdatedDate       time.Time
	Files             []GetStatusFile
}

GetStatusResponse defines get status response

type LocaleWorkflow

type LocaleWorkflow struct {
	TargetLocaleID string `json:"targetLocaleId"`
	WorkflowUid    string `json:"workflowUid"`
}

LocaleWorkflow defines locale workflow

type TargetLocale

type TargetLocale struct {
	LocaleID     string
	StringsAdded int
}

TargetLocale defines target locale in get status response

type Type

type Type uint8

Type is type for Batch file types

const (
	JAVA_PROPERTIES Type = iota + 1
	IOS
	STRINGSDICT
	ANDROID
	GETTEXT
	PHP_RESOURCE
	RESX
	XLIFF
	YAML
	JSON
	XML
	HTML
	FREEMARKER
	DOCX
	PPTX
	XLSX
	IDML
	XLS
	DOC
	QT
	CSV
	TMX
	PLAIN_TEXT
	PPT
	PRES
	MADCAP
	SRT
	MARKDOWN
	DITA
	DITA_ZIP
	VTT
	PDF
	RTF
	FLARE
	FLUENT
	SVG
	DOCM
	ARB
	INDD
	XCSTRINGS
	VSDX
	VSDM

	FirstType = JAVA_PROPERTIES
	LastType  = VSDM
)

func (Type) String

func (i Type) String() string

type UploadFilePayload

type UploadFilePayload struct {
	Filename           string
	File               []byte
	FileType           Type
	FileUri            string
	LocalesToAuthorize []string
	Directives         map[string]string
}

UploadFilePayload defines upload file payload

type UploadFileResponse

type UploadFileResponse struct {
	Code string
}

UploadFileResponse defines upload file response

Jump to

Keyboard shortcuts

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