From e50212caf308008a60db6a294e4099162b910885 Mon Sep 17 00:00:00 2001 From: José Carlos Nieto Date: Sat, 20 Feb 2016 07:48:13 -0600 Subject: Updating example. --- README.md | 8 +++++--- _examples/gettext.go | 22 ++++++---------------- 2 files changed, 11 insertions(+), 19 deletions(-) diff --git a/README.md b/README.md index a916b4b..4142b5a 100644 --- a/README.md +++ b/README.md @@ -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!")) } - -- cgit v1.2.3