Adds cmd/i18n-validate that scans Go source files for i18n key usage and validates them against locale JSON files and registered intents. Features: - Scans T(), C(), I(), and qualified i18n.* calls - Expands ./... pattern to find all Go packages - Validates message keys against locale JSON files - Validates intent keys against registered core.* intents - Reports missing keys with file:line locations - Skips constant references (type-safe usage) Usage: go run ./cmd/i18n-validate ./... task i18n:validate Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
130 lines
4.1 KiB
Go
130 lines
4.1 KiB
Go
// Package i18n provides internationalization for the CLI.
|
|
//
|
|
// To validate i18n key usage:
|
|
//
|
|
// go run ./cmd/i18n-validate ./...
|
|
// task i18n:validate
|
|
package i18n
|
|
|
|
// Intent keys for type-safe intent references.
|
|
// Use these constants instead of string literals to catch typos at compile time.
|
|
//
|
|
// result := C(IntentCoreDelete, S("file", "config.yaml"))
|
|
const (
|
|
// Destructive actions
|
|
IntentCoreDelete = "core.delete"
|
|
IntentCoreRemove = "core.remove"
|
|
IntentCoreDiscard = "core.discard"
|
|
IntentCoreReset = "core.reset"
|
|
IntentCoreOverwrite = "core.overwrite"
|
|
|
|
// Creation actions
|
|
IntentCoreCreate = "core.create"
|
|
IntentCoreAdd = "core.add"
|
|
IntentCoreClone = "core.clone"
|
|
IntentCoreCopy = "core.copy"
|
|
|
|
// Modification actions
|
|
IntentCoreSave = "core.save"
|
|
IntentCoreUpdate = "core.update"
|
|
IntentCoreRename = "core.rename"
|
|
IntentCoreMove = "core.move"
|
|
|
|
// Git actions
|
|
IntentCoreCommit = "core.commit"
|
|
IntentCorePush = "core.push"
|
|
IntentCorePull = "core.pull"
|
|
IntentCoreMerge = "core.merge"
|
|
IntentCoreRebase = "core.rebase"
|
|
|
|
// Network actions
|
|
IntentCoreInstall = "core.install"
|
|
IntentCoreDownload = "core.download"
|
|
IntentCoreUpload = "core.upload"
|
|
IntentCorePublish = "core.publish"
|
|
IntentCoreDeploy = "core.deploy"
|
|
|
|
// Process actions
|
|
IntentCoreStart = "core.start"
|
|
IntentCoreStop = "core.stop"
|
|
IntentCoreRestart = "core.restart"
|
|
IntentCoreRun = "core.run"
|
|
IntentCoreBuild = "core.build"
|
|
IntentCoreTest = "core.test"
|
|
|
|
// Information actions
|
|
IntentCoreContinue = "core.continue"
|
|
IntentCoreProceed = "core.proceed"
|
|
IntentCoreConfirm = "core.confirm"
|
|
|
|
// Additional actions
|
|
IntentCoreSync = "core.sync"
|
|
IntentCoreBoot = "core.boot"
|
|
IntentCoreFormat = "core.format"
|
|
IntentCoreAnalyse = "core.analyse"
|
|
IntentCoreLink = "core.link"
|
|
IntentCoreUnlink = "core.unlink"
|
|
IntentCoreFetch = "core.fetch"
|
|
IntentCoreGenerate = "core.generate"
|
|
IntentCoreValidate = "core.validate"
|
|
IntentCoreCheck = "core.check"
|
|
IntentCoreScan = "core.scan"
|
|
)
|
|
|
|
// Common message keys for type-safe message references.
|
|
const (
|
|
// CLI status messages
|
|
KeyCliSuccess = "cli.success"
|
|
KeyCliError = "cli.error"
|
|
KeyCliWarning = "cli.warning"
|
|
KeyCliInfo = "cli.info"
|
|
KeyCliDone = "cli.done"
|
|
KeyCliFailed = "cli.failed"
|
|
KeyCliPass = "cli.pass"
|
|
KeyCliFail = "cli.fail"
|
|
KeyCliOK = "cli.ok"
|
|
KeyCliSkip = "cli.skip"
|
|
KeyCliPending = "cli.pending"
|
|
KeyCliCompleted = "cli.completed"
|
|
KeyCliCancelled = "cli.cancelled"
|
|
KeyCliAborted = "cli.aborted"
|
|
|
|
// Common prompts
|
|
KeyCommonPromptYes = "common.prompt.yes"
|
|
KeyCommonPromptNo = "common.prompt.no"
|
|
KeyCommonPromptContinue = "common.prompt.continue"
|
|
KeyCommonPromptProceed = "common.prompt.proceed"
|
|
KeyCommonPromptConfirm = "common.prompt.confirm"
|
|
KeyCommonPromptAbort = "common.prompt.abort"
|
|
KeyCommonPromptCancel = "common.prompt.cancel"
|
|
|
|
// Common labels
|
|
KeyCommonLabelError = "common.label.error"
|
|
KeyCommonLabelDone = "common.label.done"
|
|
KeyCommonLabelStatus = "common.label.status"
|
|
KeyCommonLabelVersion = "common.label.version"
|
|
KeyCommonLabelSummary = "common.label.summary"
|
|
KeyCommonLabelSuccess = "common.label.success"
|
|
KeyCommonLabelWarning = "common.label.warning"
|
|
KeyCommonLabelNote = "common.label.note"
|
|
KeyCommonLabelTotal = "common.label.total"
|
|
KeyCommonLabelCoverage = "common.label.coverage"
|
|
KeyCommonLabelPath = "common.label.path"
|
|
KeyCommonLabelURL = "common.label.url"
|
|
|
|
// Common status
|
|
KeyCommonStatusRunning = "common.status.running"
|
|
KeyCommonStatusStopped = "common.status.stopped"
|
|
KeyCommonStatusDirty = "common.status.dirty"
|
|
KeyCommonStatusSynced = "common.status.synced"
|
|
KeyCommonStatusUpToDate = "common.status.up_to_date"
|
|
KeyCommonStatusInstalling = "common.status.installing"
|
|
KeyCommonStatusCloning = "common.status.cloning"
|
|
|
|
// Error messages
|
|
KeyErrorNotFound = "error.not_found"
|
|
KeyErrorInvalid = "error.invalid"
|
|
KeyErrorPermission = "error.permission"
|
|
KeyErrorTimeout = "error.timeout"
|
|
KeyErrorNetwork = "error.network"
|
|
)
|