domain

package
v0.0.0-...-be3c4a6 Latest Latest
Warning

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

Go to latest
Published: Dec 20, 2025 License: GPL-3.0 Imports: 0 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Comment

type Comment struct {
	// ID is the unique identifier calculated based on semantics
	// Rule: SHA1(file_path + language + symbol + normalized_text)
	ID string `json:"id"`

	// File is the file path relative to project root
	File string `json:"file"`

	// Language is the programming language identifier (e.g., "go", "rust")
	Language string `json:"language"`

	// Symbol is the semantic symbol path (e.g., "package.main.CalculateBalance")
	// For comments not bound to specific symbols, use "file.global" or similar
	Symbol string `json:"symbol"`

	// Range is the position of the comment in the source code
	Range TextRange `json:"range"`

	// SourceText is the original text of the comment (English)
	SourceText string `json:"sourceText"`

	// Type is the type of the comment
	Type CommentType `json:"type"`

	// LocalizedText is the translated text (Optional, populated during scan --with-translations)
	LocalizedText string `json:"localizedText,omitempty"`
}

Comment represents a single comment extracted from AST

type CommentType

type CommentType string

CommentType defines the type of comment

const (
	CommentTypeLine  CommentType = "line"  // Single line comment //
	CommentTypeBlock CommentType = "block" // Block comment /* */
	CommentTypeDoc   CommentType = "doc"   // Documentation comment
)

type LocalizedComment

type LocalizedComment struct {
	// CommentID references the corresponding Comment.ID
	CommentID string `json:"commentId"`

	// Lang is the target language code (BCP 47, e.g., "zh-CN")
	Lang string `json:"lang"`

	// Text is the translated text
	Text string `json:"text"`
}

LocalizedComment represents the localized version of a comment

type Mapping

type Mapping struct {
	// Version is the version of the mapping file format (e.g., "1.0")
	Version string `json:"version"`

	// SourceLanguage is the language in source code (usually "en")
	SourceLanguage string `json:"sourceLanguage"`

	// TargetLanguage is the local target language (e.g., "zh-CN")
	TargetLanguage string `json:"targetLanguage"`

	// Comments stores the mapping data
	// First Level Key: Comment.ID
	// Second Level Key: Language Code (e.g., "zh-CN")
	// Value: Translated Text
	Comments map[string]map[string]string `json:"comments"`
}

Mapping stores the multi-language mappings for the entire project

type TextRange

type TextRange struct {
	StartLine int `json:"startLine"` // Start line number
	StartCol  int `json:"startCol"`  // Start column number
	EndLine   int `json:"endLine"`   // End line number
	EndCol    int `json:"endCol"`    // End column number
}

TextRange represents the range of text in the source code (1-based)

Jump to

Keyboard shortcuts

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