model

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: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MarshalXCStrings

func MarshalXCStrings(xcstrings *XCStrings) ([]byte, error)

MarshalXCStrings marshals xcstrings to pretty JSON.

func SaveXCStrings

func SaveXCStrings(filePath string, xcstrings *XCStrings) error

SaveXCStrings saves an xcstrings file to disk

Types

type Localization

type Localization struct {
	StringUnit StringUnit `json:"stringUnit"`
}

Localization represents a localization for a specific language

type StringEntry

type StringEntry struct {
	Localizations   map[string]Localization `json:"localizations,omitempty"`
	ShouldTranslate *bool                   `json:"shouldTranslate,omitempty"`
}

StringEntry represents a single string entry with its localizations

type StringUnit

type StringUnit struct {
	State string `json:"state"`
	Value string `json:"value"`
}

StringUnit contains the translation state and value

type TranslationProvider

type TranslationProvider interface {
	Translate(ctx context.Context, req TranslationRequest) (TranslationResponse, error)
}

TranslationProvider defines the interface for translation providers

type TranslationRequest

type TranslationRequest struct {
	Key            string
	Text           string
	SourceLanguage string
	TargetLanguage string
}

TranslationRequest represents a request to translate a string

type TranslationResponse

type TranslationResponse struct {
	Key            string
	TargetLanguage string
	TranslatedText string
	Error          error
}

TranslationResponse represents a response from a translation provider

type XCStrings

type XCStrings struct {
	SourceLanguage string                 `json:"sourceLanguage"`
	Strings        map[string]StringEntry `json:"strings"`
	Version        string                 `json:"version"`
}

XCStrings represents the structure of a Localizable.xcstrings file

func LoadXCStrings

func LoadXCStrings(filePath string) (*XCStrings, error)

LoadXCStrings loads an xcstrings file from disk

func ParseXCStrings

func ParseXCStrings(data []byte) (*XCStrings, error)

ParseXCStrings parses xcstrings content from bytes.

Jump to

Keyboard shortcuts

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