diff options
author | José Carlos Nieto <jose.carlos@menteslibres.net> | 2016-02-20 07:29:59 -0600 |
---|---|---|
committer | José Carlos Nieto <jose.carlos@menteslibres.net> | 2016-02-20 07:29:59 -0600 |
commit | 5269cf26ba096845b4a62901b7b1ebb49781177a (patch) | |
tree | 0121d74371e218ee5f37d0b5ed3be0993ed89ffc /_examples/gettext.go | |
parent | Merge pull request #6 from mvo5/feature/xgettext (diff) | |
download | gotext-5269cf26ba096845b4a62901b7b1ebb49781177a.tar.gz gotext-5269cf26ba096845b4a62901b7b1ebb49781177a.tar.xz |
Code cleaning.
Diffstat (limited to '_examples/gettext.go')
-rw-r--r-- | _examples/gettext.go | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/_examples/gettext.go b/_examples/gettext.go new file mode 100644 index 0000000..a01e0d5 --- /dev/null +++ b/_examples/gettext.go @@ -0,0 +1,31 @@ +package main + +import ( + "github.com/gosexy/gettext" + "fmt" + "os" +) + +func main() { + gettext.BindTextdomain("example", ".") + gettext.Textdomain("example") + + os.Setenv("LANGUAGE", "es_MX.utf8") + + gettext.SetLocale(gettext.LC_ALL, "") + + fmt.Println(gettext.Gettext("Hello, world!")) + + os.Setenv("LANGUAGE", "de_DE.utf8") + + gettext.SetLocale(gettext.LC_ALL, "") + + fmt.Println(gettext.Gettext("Hello, world!")) + + os.Setenv("LANGUAGE", "en_US.utf8") + + gettext.SetLocale(gettext.LC_ALL, "") + + fmt.Println(gettext.Gettext("Hello, world!")) +} + |