Versions in this module Expand all Collapse all v0 v0.2.0 Oct 18, 2026 Changes in this version + const EnvAPIKey + const EnvLegacyAPIKey + const PhaseConvert + const PhaseDiscover + const PhaseDone + const PhaseIndex + const PhaseMap + const PhaseSave + const PhaseScan + const PhaseTranslate + var ErrAlreadyInitialized = errors.New("配置文件已存在") + var ErrBusy = errors.New("项目正在执行其他任务") + var ErrNoToken = errors.New("未找到 API 令牌") + var ErrNotInitialized = errors.New("项目尚未初始化") + var ErrProfileExists = errors.New("配置档已存在") + var ErrProfileNotFound = errors.New("配置档不存在") + var ErrUnknownComment = errors.New("未知的注释 ID") + var Version = "dev" + func ValidateProfileName(name string) error + type CommentRecord struct + Error string + File string + ID string + Lang string + LangSource string + Language string + Original string + Parts int + Range index.Range + SourceKey string + Symbol string + Texts map[string]string + Type string + func (r *CommentRecord) Translation(lang string) string + type ConvertOptions struct + Dir string + DryRun bool + File string + Progress ProgressFunc + To string + type ConvertResult = workflow.ConvertResult + type Event = events.Event + type Failure = workflow.Failure + type Global struct + func OpenGlobal(opts ...Option) (*Global, error) + func (g *Global) CopyProfile(from, to string) error + func (g *Global) DeleteProfile(name string) error + func (g *Global) DeleteProfileToken(profile string) error + func (g *Global) File() (*config.File, error) + func (g *Global) MigratePlaintextTokens() ([]MigratedToken, error) + func (g *Global) Path() string + func (g *Global) PlaintextTokens() ([]PlaintextToken, error) + func (g *Global) ProfileTokenStatus(profile string) (saved bool, last4 string, err error) + func (g *Global) Profiles() ([]string, error) + func (g *Global) RenameProfile(from, to string) error + func (g *Global) SaveProfile(name string, fields config.ProviderFields) error + func (g *Global) SetProfileToken(profile string, s Secret) error + func (g *Global) Update(fn func(*config.File) error) error + type InitOptions struct + ExcludePatterns []string + Force bool + LocalLanguage *string + Profile *string + Provider *string + Snapshot *config.Config + SourceLanguage *string + type Logger = logging.Logger + type MapOptions struct + DryRun bool + NoCache bool + Progress ProgressFunc + Prune bool + ScanDir string + Workers int + type MapUpdateResult = workflow.MapUpdateResult + type MigratedToken struct + Account string + type Option func(*settings) + func WithConfigFile(path string) Option + func WithEnv(getenv func(string) string) Option + func WithGlobalDir(dir string) Option + func WithLogger(l Logger) Option + func WithOverrides(ov config.Overrides) Option + func WithSecretStore(s SecretStore) Option + func WithTranslator(t core.Translator) Option + type Phase = events.Phase + type PlaintextToken struct + Layer config.Layer + Location string + Path string + Profile string + type ProgressFunc = events.Func + type Project struct + func Open(root string, opts ...Option) (*Project, error) + func (p *Project) Comments() ([]CommentRecord, error) + func (p *Project) Config() (*config.Effective, error) + func (p *Project) ConfigPath() string + func (p *Project) Convert(ctx context.Context, opts ConvertOptions) (*ConvertResult, error) + func (p *Project) DataDir() string + func (p *Project) DeleteProjectToken(profile string) error + func (p *Project) EnsureGitignore() (bool, error) + func (p *Project) Failures() ([]Failure, error) + func (p *Project) Files() (global, project *config.File, err error) + func (p *Project) GlobalConfigPath() string + func (p *Project) HooksInstalled() bool + func (p *Project) Init(opts InitOptions) error + func (p *Project) Initialized() bool + func (p *Project) InstallHooks() error + func (p *Project) IsGitRepo() bool + func (p *Project) MigratePlaintextTokens() ([]MigratedToken, error) + func (p *Project) Root() string + func (p *Project) Scan(ctx context.Context, opts ScanOptions) (*ScanResult, error) + func (p *Project) SetCommentLanguage(id, lang string) error + func (p *Project) SetProjectToken(profile string, s Secret) error + func (p *Project) SetTranslation(id, lang, text string) error + func (p *Project) Status() (*Status, error) + func (p *Project) TokenStatus() (*TokenStatus, error) + func (p *Project) Translate(ctx context.Context, opts TranslateOptions) (*TranslateResult, error) + func (p *Project) TranslateText(ctx context.Context, text, from, to string) (string, error) + func (p *Project) UpdateConfig(fn func(*config.File) error) error + func (p *Project) UpdateMappings(ctx context.Context, opts MapOptions) (*MapUpdateResult, error) + type ScanOptions struct + Dir string + Progress ProgressFunc + type ScanResult = scanner.Result + type Secret = secrets.Secret + func NewSecret(b []byte) Secret + type SecretStore = secrets.Store + type Status struct + Comments int + Failed int + HasIndex bool + HasMappings bool + IndexGeneratedAt string + Initialized bool + Languages map[string]int + Pending int + Translated int + type TokenSource string + const TokenSourceEnv + const TokenSourceFile + const TokenSourceGlobal + const TokenSourceNone + const TokenSourceProject + type TokenStatus struct + EnvVar string + GlobalAccount string + GlobalBlocked bool + GlobalLast4 string + GlobalSaved bool + Last4 string + Plaintext []PlaintextToken + Profile string + ProjectAccount string + ProjectLast4 string + ProjectSaved bool + Required bool + Source TokenSource + StoreError string + type TranslateOptions struct + Concurrency int + OnlyIDs []string + Progress ProgressFunc + type TranslateResult = workflow.TranslateResult