diff options
-rw-r--r-- | README.md | 8 | ||||
-rw-r--r-- | _examples/gettext.go | 22 | ||||
-rw-r--r-- | gettext.go | 2 |
3 files changed, 13 insertions, 19 deletions
@@ -7,6 +7,10 @@ library for writing multilingual systems. * [GNU gettext][1] +### Linux + +Installation should be straightforward on Linux. + ### OSX Installing gettext on a Mac is a bit awkward: @@ -20,9 +24,7 @@ export CGO_CPPFLAGS=-I/usr/local/opt/gettext/include go get github.com/gosexy/gettext ``` -Installation should be straightforward on Linux. - -## Installation +## Getting the library Use `go get` to download and install the binding: diff --git a/_examples/gettext.go b/_examples/gettext.go index a01e0d5..9fa63b2 100644 --- a/_examples/gettext.go +++ b/_examples/gettext.go @@ -1,31 +1,21 @@ package main import ( - "github.com/gosexy/gettext" "fmt" - "os" + + "github.com/gosexy/gettext" ) func main() { - gettext.BindTextdomain("example", ".") + gettext.BindTextdomain("example", "./") gettext.Textdomain("example") - os.Setenv("LANGUAGE", "es_MX.utf8") - - gettext.SetLocale(gettext.LC_ALL, "") - + gettext.SetLocale(gettext.LcAll, "es_MX.utf8") fmt.Println(gettext.Gettext("Hello, world!")) - os.Setenv("LANGUAGE", "de_DE.utf8") - - gettext.SetLocale(gettext.LC_ALL, "") - + gettext.SetLocale(gettext.LcAll, "de_DE.utf8") fmt.Println(gettext.Gettext("Hello, world!")) - os.Setenv("LANGUAGE", "en_US.utf8") - - gettext.SetLocale(gettext.LC_ALL, "") - + gettext.SetLocale(gettext.LcAll, "en_US.utf8") fmt.Println(gettext.Gettext("Hello, world!")) } - @@ -23,6 +23,8 @@ package gettext /* +// #cgo LDFLAGS: -lintl // Use this if: /usr/bin/ld: cannot find -lintl, see https://github.com/gosexy/gettext/issues/1 + #include <libintl.h> #include <locale.h> |