aboutsummaryrefslogtreecommitdiff
path: root/_examples/gettext.go
blob: 9fa63b2abaf3beffa8e1c1a445b323e95c42cf40 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
package main

import (
	"fmt"

	"github.com/gosexy/gettext"
)

func main() {
	gettext.BindTextdomain("example", "./")
	gettext.Textdomain("example")

	gettext.SetLocale(gettext.LcAll, "es_MX.utf8")
	fmt.Println(gettext.Gettext("Hello, world!"))

	gettext.SetLocale(gettext.LcAll, "de_DE.utf8")
	fmt.Println(gettext.Gettext("Hello, world!"))

	gettext.SetLocale(gettext.LcAll, "en_US.utf8")
	fmt.Println(gettext.Gettext("Hello, world!"))
}