aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--README.md8
-rw-r--r--_examples/gettext.go22
-rw-r--r--gettext.go2
3 files changed, 13 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!"))
}
-
diff --git a/gettext.go b/gettext.go
index 4550ba1..cfd146b 100644
--- a/gettext.go
+++ b/gettext.go
@@ -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>