diff options
author | José Carlos Nieto <xiam@menteslibres.org> | 2012-10-06 16:07:42 -0500 |
---|---|---|
committer | José Carlos Nieto <xiam@menteslibres.org> | 2012-10-06 16:07:42 -0500 |
commit | f7f4bcdaad57ce74a2b0e32c771d30178e0b14e1 (patch) | |
tree | a28a5a3622436028ae93185a2cb603efa05464ad /examples/gettext.go | |
parent | Initial commit. (diff) | |
download | gotext-f7f4bcdaad57ce74a2b0e32c771d30178e0b14e1.tar.gz gotext-f7f4bcdaad57ce74a2b0e32c771d30178e0b14e1.tar.xz |
Adding Deutsch and Español examples.
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!")) +} + |