Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CleanLiteralKey ¶
CleanLiteralKey normalizes a scanned literal translation key.
func UsageIdentity ¶
UsageIdentity returns a stable identity for a namespace and key.
Types ¶
type Confidence ¶
type Confidence string
Confidence indicates how reliable a scanned usage signal is.
const ( ConfidenceExact Confidence = "exact" ConfidenceHigh Confidence = "high" ConfidenceMedium Confidence = "medium" ConfidenceLow Confidence = "low" )
Confidence levels for scanner evidence.
type DynamicHint ¶
type DynamicHint struct {
Namespace string `json:"namespace,omitempty"`
KeyPattern string `json:"keyPattern,omitempty"`
FilePath string `json:"file"`
Line int `json:"line"`
Column int `json:"column"`
Snippet string `json:"snippet"`
Pattern string `json:"pattern"`
Confidence Confidence `json:"confidence"`
Message string `json:"message"`
}
DynamicHint describes a likely dynamic translation key usage.
type Evidence ¶
type Evidence struct {
Namespace string `json:"namespace,omitempty"`
Key string `json:"key"`
FullKey string `json:"fullKey"`
FilePath string `json:"file"`
Line int `json:"line"`
Column int `json:"column"`
Snippet string `json:"snippet"`
Pattern string `json:"pattern"`
Confidence Confidence `json:"confidence"`
}
Evidence describes where a translation usage was found.
type ProgressReporter ¶
type ProgressReporter interface {
Step(ctx context.Context, message string, current int, total int)
}
ProgressReporter receives scanner progress events.
type Report ¶
type Report struct {
FilesScanned int `json:"filesScanned"`
Files []SourceFile `json:"files"`
Usages []Usage `json:"usages"`
DynamicHints []DynamicHint `json:"dynamicHints,omitzero"`
Warnings []string `json:"warnings,omitzero"`
GeneratedAt time.Time `json:"generatedAt"`
}
Report contains source scan results.
type ScanInput ¶
type ScanInput struct {
Files []string `json:"files,omitzero" jsonschema:"optional project-relative source files to scan"`
Progress ProgressReporter `json:"-"`
BatchSize int `json:"batchSize,omitzero" jsonschema:"optional progress notification batch size; defaults to 25"`
}
ScanInput configures a source scan.
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
Service scans source files for translation usage.
func NewService ¶
NewService creates a scanner service scoped by guard and configService.
func (*Service) DiscoverSourceFiles ¶
func (s *Service) DiscoverSourceFiles(ctx context.Context, requested []string) ([]SourceFile, error)
DiscoverSourceFiles returns source files to scan.
type SourceFile ¶
SourceFile describes a scanned source file.