i18n

package
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: Dec 2, 2018 License: MPL-2.0 Imports: 9 Imported by: 84

Documentation

Overview

Package i18n provides internationalization support for applications.

Index

Constants

View Source
const (
	// Extension is the file name extension required on localization files.
	Extension = ".i18n"
)

Variables

View Source
var (
	// Dir is the directory to scan for localization files. This will occur
	// only once, the first time a call to Text() is made. If you do not set
	// this prior to the first call, a directory in the same location as the
	// executable with "_i18n" appended to the executable name (sans any
	// extension) will be used.
	Dir string
	// Language is the language that should be used for text returned from
	// calls to Text(). It is initialized to the value of the LC_ALL
	// environment variable, if set. If not, then it falls back to the value
	// of the LANG environment variable. You may set this at runtime, forcing
	// a particular language for all subsequent calls to Text().
	Language = initLanguage()
	// Languages is a slice of languages to fall back to should the one
	// specified in the Language variable not be available. If is initialized
	// to the value of the LANGUAGE environment variable.
	Languages = strings.Split(os.Getenv("LANGUAGE"), ":")
	// Log is set to discard by default.
	Log logadapter.ErrorLogger = &logadapter.Discarder{}
)

Functions

func Text

func Text(text string) string

Text returns a localized version of the text if one exists, or the original text if not.

Types

This section is empty.

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

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