i18n

package
v0.1.21 Latest Latest
Warning

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

Go to latest
Published: Jul 30, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ErrorText

func ErrorText(err error) string

ErrorText returns a localized error message

func Text

func Text(key Key, vars ...Vars) string

Text returns a localized message with optional named interpolation

Types

type Error

type Error struct {
	// contains filtered or unexported fields
}

Error identifies a localizable error and its interpolation variables

func NewError

func NewError[S ~string](key S) *Error

NewError returns an error backed by a localized message

func (*Error) Error

func (e *Error) Error() string

func (*Error) WithVars

func (e *Error) WithVars(vars Vars) *Error

WithVars returns a copy with interpolation variables attached

type Key

type Key string

Key identifies a localized message

const (
	PromptCommand          Key = "prompt.command"
	PromptSearchForward    Key = "prompt.searchForward"
	PromptSearchBackward   Key = "prompt.searchBackward"
	PromptRename           Key = "prompt.rename"
	PromptScrollbackSearch Key = "prompt.scrollbackSearch"
	PromptSelect           Key = "prompt.select"
	PromptSplit            Key = "prompt.split"
	PromptKeep             Key = "prompt.keep"
	PromptRemove           Key = "prompt.remove"
	PromptPipe             Key = "prompt.pipe"
	PromptInsertOutput     Key = "prompt.insertOutput"
	PromptFilter           Key = "prompt.filter"
	PromptPipeTo           Key = "prompt.pipeTo"
	PromptAppendOutput     Key = "prompt.appendOutput"

	ErrorMessage       Key = "error.message"
	ErrorNoDocument    Key = "error.noDocument"
	ErrorNoFilename    Key = "error.noFilename"
	ErrorLSPUndefined  Key = "error.lspUndefined"
	ErrorNoSuchCommand Key = "error.noSuchCommand"

	ErrorUnknownOptionKey       Key = "error.unknownOptionKey"
	ErrorInvalidOptionKey       Key = "error.invalidOptionKey"
	ErrorUsageGet               Key = "error.usageGet"
	ErrorUsageSet               Key = "error.usageSet"
	ErrorUsageToggle            Key = "error.usageToggle"
	ErrorNoLineNumber           Key = "error.noLineNumber"
	ErrorInvalidLineNumber      Key = "error.invalidLineNumber"
	ErrorUnknownLineEnding      Key = "error.unknownLineEnding"
	ErrorExpectedIndent         Key = "error.expectedIndent"
	ErrorThemeLoad              Key = "error.themeLoad"
	ErrorThemeTrueColor         Key = "error.themeTrueColor"
	ErrorConfigUnavailable      Key = "error.configUnavailable"
	ErrorNoDirectory            Key = "error.noDirectory"
	ErrorInvalidWidth           Key = "error.invalidWidth"
	ErrorBufferReadOnly         Key = "error.bufferReadOnly"
	ErrorNoRangeFormatting      Key = "error.noRangeFormatting"
	ErrorFormatSelectionSingle  Key = "error.formatSelectionSingle"
	ErrorUnsavedQuit            Key = "error.unsavedQuit"
	ErrorUnsavedQuitAll         Key = "error.unsavedQuitAll"
	ErrorUnsavedCquit           Key = "error.unsavedCquit"
	ErrorUnsavedMove            Key = "error.unsavedMove"
	ErrorUnsavedBufferClose     Key = "error.unsavedBufferClose"
	ErrorUnsavedBufferCloseAll  Key = "error.unsavedBufferCloseAll"
	ErrorWorkspaceUntrustedHint Key = "error.workspaceUntrustedHint"
	ErrorLogUnavailable         Key = "error.logUnavailable"

	StatusWritten          Key = "status.written"
	StatusAllWritten       Key = "status.allWritten"
	StatusWrittenAndClosed Key = "status.writtenAndClosed"
	StatusNoFormatter      Key = "status.noFormatter"
	StatusNoMoreMatches    Key = "status.noMoreMatches"
	StatusSearchWrapped    Key = "status.searchWrapped"
	StatusRegisterSet      Key = "status.registerSet"
	StatusNoSelections     Key = "status.noSelections"
	StatusYankedSelection  Key = "status.yankedSelection"
	StatusYankedSelections Key = "status.yankedSelections"
	StatusDiffUnavailable  Key = "status.diffUnavailable"
	StatusClipboardCopied  Key = "status.clipboardCopied"

	StatusNoDeclaration      Key = "status.noDeclaration"
	StatusNoDefinition       Key = "status.noDefinition"
	StatusNoTypeDefinition   Key = "status.noTypeDefinition"
	StatusNoImplementation   Key = "status.noImplementation"
	StatusNoReferences       Key = "status.noReferences"
	StatusNoSymbolReferences Key = "status.noSymbolReferences"
	StatusNoDocumentSymbols  Key = "status.noDocumentSymbols"
	StatusNoCodeActions      Key = "status.noCodeActions"
	StatusNoHoverResults     Key = "status.noHoverResults"
	StatusLSPNoNavigation    Key = "status.lspNoNavigation"
	StatusLSPNoHighlights    Key = "status.lspNoHighlights"
	StatusLSPNoDocSymbols    Key = "status.lspNoDocSymbols"
	StatusLSPNoWorkSymbols   Key = "status.lspNoWorkSymbols"
	StatusLSPNoCodeActions   Key = "status.lspNoCodeActions"
	StatusLSPNoRename        Key = "status.lspNoRename"
	StatusLSPNoHover         Key = "status.lspNoHover"
	StatusLSPNoSignatureHelp Key = "status.lspNoSignatureHelp"

	StatusPickerTypeToSearch Key = "status.pickerTypeToSearch"
	StatusPickerSearching    Key = "status.pickerSearching"
	StatusPickerNoResults    Key = "status.pickerNoResults"
	StatusImageLoading       Key = "status.imageLoading"
	StatusImageUnsupported   Key = "status.imageUnsupported"
	StatusTerminalStarting   Key = "status.terminalStarting"
	StatusPaneMaximized      Key = "status.paneMaximized"

	StatusFileDeleted          Key = "status.fileDeleted"
	StatusFileChanged          Key = "status.fileChanged"
	StatusReloadFailed         Key = "status.reloadFailed"
	StatusFileReloaded         Key = "status.fileReloaded"
	StatusFileWatchUnavailable Key = "status.fileWatchUnavailable"

	HintResize Key = "hint.resize"
)

type Vars

type Vars map[string]any

Vars supplies named values for message interpolation

Jump to

Keyboard shortcuts

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