dict

package
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: Jul 16, 2023 License: Apache-2.0, BSD-3-Clause, ISC Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrInvalidLocale is returned if a specified locale is invalid.
	ErrInvalidLocale = errors.New("invalid locale")
)

Functions

This section is empty.

Types

type Dict

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

Dict provides translated strings appropriate for a specific locale.

func NewDict

func NewDict(locale string) (*Dict, error)

NewDict returns a new Dict with the specified locale.

func (*Dict) DirPath

func (d *Dict) DirPath() string

DirPath returns the translations directory path of the Dict.

func (*Dict) Locale

func (d *Dict) Locale() string

Locale returns the locale of the Dict.

func (*Dict) Translation

func (d *Dict) Translation(source string, context ...string) string

Translation returns a translation of the source string to the locale of the Dict or the source string, if no matching translation was found.

Provided context arguments are used for disambiguation.

Jump to

Keyboard shortcuts

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