diff

package
v0.15.0 Latest Latest
Warning

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

Go to latest
Published: Aug 23, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type KeyDiff

type KeyDiff struct {
	Locale             string            `json:"locale"`
	Namespace          string            `json:"namespace"`
	Key                string            `json:"key"`
	Status             KeyStatus         `json:"status"`
	SourceValue        string            `json:"sourceValue,omitzero"`
	TargetValue        string            `json:"targetValue,omitzero"`
	SourceHash         string            `json:"sourceHash,omitzero"`
	TranslatedFromHash string            `json:"translatedFromHash,omitzero"`
	TargetHash         string            `json:"targetHash,omitzero"`
	SourceFilePath     string            `json:"sourceFilePath,omitzero"`
	TargetFilePath     string            `json:"targetFilePath,omitzero"`
	Validation         []validate.Issue  `json:"validation,omitzero"`
	Metadata           map[string]string `json:"metadata,omitzero"`
}

KeyDiff describes one source/target key comparison.

type KeyStatus

type KeyStatus string

KeyStatus classifies the relationship between source and target keys.

const (
	Current KeyStatus = "current"
	Missing KeyStatus = "missing"
	Stale   KeyStatus = "stale"
	Extra   KeyStatus = "extra"
	Invalid KeyStatus = "invalid"
	Unknown KeyStatus = "unknown"
)

Key diff statuses.

type Report

type Report struct {
	SourceLocale  string    `json:"sourceLocale"`
	TargetLocales []string  `json:"targetLocales"`
	Summary       Summary   `json:"summary"`
	Items         []KeyDiff `json:"items"`
	Warnings      []string  `json:"warnings,omitzero"`
}

Report contains locale diff analysis results.

type Service

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

Service analyzes differences between source and target locale content.

func NewService

func NewService(locales *locale.Service, stateService *state.Service, validator *validate.Service) *Service

NewService creates a diff analysis service.

func (*Service) Analyze

func (s *Service) Analyze(ctx context.Context) (Report, error)

Analyze compares locale inventory with translation state.

type StatusCounts

type StatusCounts struct {
	Current int `json:"current"`
	Missing int `json:"missing"`
	Stale   int `json:"stale"`
	Extra   int `json:"extra"`
	Invalid int `json:"invalid"`
	Unknown int `json:"unknown"`
}

StatusCounts counts key statuses for one locale.

type Summary

type Summary struct {
	Total    int                     `json:"total"`
	Current  int                     `json:"current"`
	Missing  int                     `json:"missing"`
	Stale    int                     `json:"stale"`
	Extra    int                     `json:"extra"`
	Invalid  int                     `json:"invalid"`
	Unknown  int                     `json:"unknown"`
	ByLocale map[string]StatusCounts `json:"byLocale,omitzero"`
}

Summary counts key diff statuses.

func Summarize

func Summarize(items []KeyDiff) Summary

Summarize counts key diff statuses across items.

Jump to

Keyboard shortcuts

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