translation

package
v1.14.9 Latest Latest
Warning

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

Go to latest
Published: Dec 12, 2024 License: MIT Imports: 1 Imported by: 7

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Bool

func Bool(value bool) *bool

Types

type Loader

type Loader interface {
	// Load the messages for the given locale.
	Load(locale string, group string) (map[string]any, error)
}

type Option

type Option struct {
	Fallback *bool
	Locale   string
	Replace  map[string]string
}

type Translator

type Translator interface {
	// Choice gets a translation according to an integer value.
	Choice(key string, number int, options ...Option) string
	// Get the translation for the given key.
	Get(key string, options ...Option) string
	// GetFallback get the current application/context fallback locale.
	GetFallback() string
	// CurrentLocale get the current application/context locale.
	CurrentLocale() string
	// Has checks if a translation exists for a given key.
	Has(key string, options ...Option) bool
	// SetFallback set the current application/context fallback locale.
	SetFallback(locale string) context.Context
	// SetLocale set the current application/context locale.
	SetLocale(locale string) context.Context
}

Jump to

Keyboard shortcuts

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