server

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Dec 19, 2025 License: MIT Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewApp

func NewApp() (*fiber.App, error)

NewApp constructs the Fiber app with embedded assets without starting the server.

func Serve

func Serve(addr string) error

Serve starts the Fiber server using the embedded UI assets.

func ServeWithListener

func ServeWithListener(ln net.Listener) (*fiber.App, <-chan error, error)

ServeWithListener serves the app using a pre-bound listener (useful for GUI mode).

Types

type Job

type Job struct {
	ID        string    `json:"id"`
	Status    string    `json:"status"` // running, done, error
	Message   string    `json:"message,omitempty"`
	Done      int       `json:"done"`
	Total     int       `json:"total"`
	UpdatedAt time.Time `json:"updatedAt"`
}

Job tracks long-running translation progress.

type Payload

type Payload struct {
	FileName           string           `json:"fileName"`
	SourceLanguage     string           `json:"sourceLanguage"`
	AvailableLanguages []string         `json:"availableLanguages"`
	TotalStrings       int              `json:"totalStrings"`
	Entries            []UILocalization `json:"entries"`
	Warning            string           `json:"warning,omitempty"`
}

Payload represents the data returned to the UI.

type ProviderConfig

type ProviderConfig struct {
	APIKey      string  `json:"apiKey"`
	APIBaseURL  string  `json:"apiBaseUrl"`
	Model       string  `json:"model"`
	Glossary    string  `json:"glossary"`
	AppID       string  `json:"appId"`
	AppSecret   string  `json:"appSecret"`
	Temperature float64 `json:"temperature"`
	MaxTokens   int     `json:"maxTokens"`
	Formality   string  `json:"formality"`
	IsFree      bool    `json:"isFree"`
}

ProviderConfig is the union of provider-specific options we support.

type ServerState

type ServerState struct {
	// contains filtered or unexported fields
}

ServerState holds the in-memory working copy of the xcstrings data.

type TranslateRequest

type TranslateRequest struct {
	Provider        string         `json:"provider"`
	TargetLanguages []string       `json:"targetLanguages"`
	SourceLanguage  string         `json:"sourceLanguage"`
	Concurrency     int            `json:"concurrency"`
	TimeoutSeconds  int            `json:"timeoutSeconds"`
	Config          ProviderConfig `json:"config"`
}

TranslateRequest describes the batch translate payload from the UI.

type UILocalization

type UILocalization struct {
	Key          string            `json:"key"`
	Source       string            `json:"source"`
	State        string            `json:"state"`
	Translations map[string]string `json:"translations"`
	Missing      []string          `json:"missing"`
}

UILocalization is a flattened view for the table UI.

Jump to

Keyboard shortcuts

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