locale

package
v0.0.0-...-00f1f15 Latest Latest
Warning

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

Go to latest
Published: Dec 11, 2015 License: AGPL-3.0 Imports: 1 Imported by: 0

Documentation

Overview

Package locale provides tools for internationalization (I18N) and localization (L10N).

Package null provides a null message catalog backend.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SetDefaultCatalog

func SetDefaultCatalog(c MessageCatalog)

Types

type Error

type Error interface {
	error
	Stringer
}

Error is a localizable builtin.error

func Errorf

func Errorf(format string, args ...interface{}) Error

func UntranslatedError

func UntranslatedError(in error) Error

type MessageCatalog

type MessageCatalog interface {
	Locales() []Spec
	Translate(locale Spec, str string) string
	TranslateN(locale Spec, singular, plural string, n int) string
	TranslateP(locale Spec, ctxt, str string) string
	TranslateNP(locale Spec, ctxt, singular, plural string, n int) string
}
var DefaultCatalog MessageCatalog = NullMessageCatalog{}

type NullMessageCatalog

type NullMessageCatalog struct{}

func (NullMessageCatalog) Locales

func (NullMessageCatalog) Locales() []Spec

func (NullMessageCatalog) Translate

func (NullMessageCatalog) Translate(locale Spec, str string) string

func (NullMessageCatalog) TranslateN

func (NullMessageCatalog) TranslateN(locale Spec, singular, plural string, n int) string

func (NullMessageCatalog) TranslateNP

func (NullMessageCatalog) TranslateNP(locale Spec, p, singular, plural string, n int) string

func (NullMessageCatalog) TranslateP

func (NullMessageCatalog) TranslateP(locale Spec, p, str string) string

type Spec

type Spec string

Spec is a locale specification; what to localize to the interpretation of it is backend-catalog dependent.

type Stringer

type Stringer interface {
	Locales() []Spec
	L10NString(Spec) string
}

Stringer is a localizable fmt.Stringer.

func Sprintf

func Sprintf(format string, args ...interface{}) Stringer

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

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