Move handler functions from mode.go to actions.go: - OnMissingKey, SetActionHandler, dispatchMissingKey mode.go now contains only Mode type and constants. interface.go keeps all types/interfaces. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
28 lines
700 B
Go
28 lines
700 B
Go
// Package i18n provides internationalization for the CLI.
|
|
package i18n
|
|
|
|
// Mode determines how the i18n service handles missing translation keys.
|
|
type Mode int
|
|
|
|
const (
|
|
// ModeNormal returns the key as-is when a translation is missing (production).
|
|
ModeNormal Mode = iota
|
|
// ModeStrict panics immediately when a translation is missing (dev/CI).
|
|
ModeStrict
|
|
// ModeCollect dispatches MissingKey actions and returns [key] (QA testing).
|
|
ModeCollect
|
|
)
|
|
|
|
// String returns the string representation of the mode.
|
|
func (m Mode) String() string {
|
|
switch m {
|
|
case ModeNormal:
|
|
return "normal"
|
|
case ModeStrict:
|
|
return "strict"
|
|
case ModeCollect:
|
|
return "collect"
|
|
default:
|
|
return "unknown"
|
|
}
|
|
}
|