Documentation
¶
Index ¶
Constants ¶
View Source
const ( CurrentVersion = 1 DefaultStatePath = ".i18n-mcp/state.json" )
State file constants.
Variables ¶
This section is empty.
Functions ¶
func SourceHash ¶
SourceHash returns a stable hash for source text.
func TargetHash ¶
TargetHash returns a stable hash for translated target text.
Types ¶
type Entry ¶
type Entry struct {
Locale string `json:"locale"`
Namespace string `json:"namespace"`
Key string `json:"key"`
SourceHash string `json:"sourceHash"`
TranslatedFromHash string `json:"translatedFromHash"`
TargetHash string `json:"targetHash,omitzero"`
Status Status `json:"status"`
Reviewed bool `json:"reviewed,omitzero"`
UpdatedAt time.Time `json:"updatedAt"`
UpdatedBy string `json:"updatedBy,omitzero"`
}
Entry records translation state for one locale key.
type File ¶
type File struct {
Version int `json:"version"`
SourceLocale string `json:"sourceLocale"`
Entries map[string]Entry `json:"entries"`
UpdatedAt time.Time `json:"updatedAt"`
}
File is the persisted translation state file.
type RebuildOptions ¶
type RebuildOptions struct {
Apply bool `json:"apply"`
}
RebuildOptions configures state rebuild behavior.
type RebuildResult ¶
type RebuildResult struct {
DryRun bool `json:"dryRun"`
Applied bool `json:"applied"`
StatePath string `json:"statePath"`
SourceLocale string `json:"sourceLocale"`
Entries int `json:"entries"`
Created int `json:"created"`
Updated int `json:"updated"`
Skipped int `json:"skipped"`
Assumptions []string `json:"assumptions"`
InventoryWarnings []locale.Warning `json:"inventoryWarnings,omitzero"`
PreviewState File `json:"previewState"`
}
RebuildResult describes the result of rebuilding state.
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
Service manages translation state files.
func NewService ¶
NewService creates a state service.
func (*Service) Rebuild ¶
func (s *Service) Rebuild(ctx context.Context, opts RebuildOptions) (RebuildResult, error)
Rebuild recreates translation state from current locale files.
type Store ¶
type Store struct {
// contains filtered or unexported fields
}
Store reads and writes the translation state file.
func NewStoreAt ¶
NewStoreAt creates a Store at path.
Click to show internal directories.
Click to hide internal directories.