1package i18n
2
3import "fmt"
4
5// Localizer represents something that can localize a string
6type Localizer interface {
7	Local(string) string
8}
9
10var g Localizer
11
12// InitLocalization should be called before using localization - it sets the variable used to access the localization interface
13func InitLocalization(gx Localizer) {
14	g = gx
15}
16
17// Local returns the given string in the local language
18func Local(v string) string {
19	return g.Local(v)
20}
21
22// Localf returns the given string in the local language. It supports Printf formatting.
23func Localf(f string, p ...interface{}) string {
24	return fmt.Sprintf(Local(f), p...)
25}
26