diff options
author | José Carlos Nieto <xiam@menteslibres.org> | 2012-10-06 16:17:07 -0500 |
---|---|---|
committer | José Carlos Nieto <xiam@menteslibres.org> | 2012-10-06 16:17:07 -0500 |
commit | dfbdf76e9d258bb8751fa76c330a48d243cd6a43 (patch) | |
tree | c70de141d9174c5fa9fdc4ca95c0ea90d8b2bd60 | |
parent | Adding Deutsch and Español examples. (diff) | |
download | gotext-dfbdf76e9d258bb8751fa76c330a48d243cd6a43.tar.gz gotext-dfbdf76e9d258bb8751fa76c330a48d243cd6a43.tar.xz |
Adding README file.
-rw-r--r-- | README.md | 63 |
1 files changed, 63 insertions, 0 deletions
diff --git a/README.md b/README.md new file mode 100644 index 0000000..70b02e0 --- /dev/null +++ b/README.md @@ -0,0 +1,63 @@ +## gosexy/gettext + +``gosexy/gettext`` is a wrapper of [GNU gettext][1], an internationalization and localization library for writing multilingual systems. + +## Requeriments + +The GNU C library. If you're using GNU/Linux, FreeBSD or OSX you should already have it. + +## Installation + +Just pull from the repository: + +```sh +$ go get github.com/gosexy/gettex +``` + +## Usage + +```go +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!")) +} +``` + +You can use ``os.Setenv`` to set the ``LANGUAGE`` environment variable or set it from a terminal: + +```sh +% export LANGUAGE="es_MX.utf8" +% ./gettext-program +``` + +## Documentation + +You can read ``gosexy/gettext`` documentation from a terminal + +```go +% go doc github.com/gosexy/gettext +``` + +The original gettext documentation can be very useful too: + +```go +% man 3 gettext +``` + +Or you can [browse it](http://go.pkgdoc.org/github.com/gosexy/gettext) online. + +[1]: http://www.gnu.org/software/gettext/ |