aboutsummaryrefslogtreecommitdiff
path: root/_examples
diff options
context:
space:
mode:
Diffstat (limited to '_examples')
-rw-r--r--_examples/de_DE.utf8/LC_MESSAGES/example.mobin0 -> 614 bytes
-rw-r--r--_examples/de_DE.utf8/example.pot37
-rw-r--r--_examples/es_MX.utf8/LC_MESSAGES/example.mobin0 -> 614 bytes
-rw-r--r--_examples/es_MX.utf8/example.pot37
-rw-r--r--_examples/gettext.go31
5 files changed, 105 insertions, 0 deletions
diff --git a/_examples/de_DE.utf8/LC_MESSAGES/example.mo b/_examples/de_DE.utf8/LC_MESSAGES/example.mo
new file mode 100644
index 0000000..9c8c27d
--- /dev/null
+++ b/_examples/de_DE.utf8/LC_MESSAGES/example.mo
Binary files differ
diff --git a/_examples/de_DE.utf8/example.pot b/_examples/de_DE.utf8/example.pot
new file mode 100644
index 0000000..9261267
--- /dev/null
+++ b/_examples/de_DE.utf8/example.pot
@@ -0,0 +1,37 @@
+# SOME DESCRIPTIVE TITLE.
+# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
+# This file is distributed under the same license as the PACKAGE package.
+# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
+#
+#, fuzzy
+msgid ""
+msgstr "Project-Id-Version: PACKAGE VERSION\n"
+ "Report-Msgid-Bugs-To: \n"
+ "POT-Creation-Date: 2012-10-06 15:47-0500\n"
+ "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
+ "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
+ "Language-Team: LANGUAGE <LL@li.org>\n"
+ "Language: \n"
+ "MIME-Version: 1.0\n"
+ "Content-Type: text/plain; charset=UTF-8\n"
+ "Content-Transfer-Encoding: 8bit\n"
+ "Plural-Forms: nplurals=INTEGER; plural=EXPRESSION;\n"
+
+#: gettext_test.go:32 gettext_test.go:40
+#, c-format
+msgid "An apple"
+msgid_plural "%d apples"
+msgstr[0] "Ein Apfel"
+msgstr[1] "%d Äpfel"
+
+#: gettext_test.go:56
+msgid "Good bye!"
+msgstr "Auf Wiedersehen!"
+
+#: gettext_test.go:48
+msgid "Good morning"
+msgstr "Guten morgen"
+
+#: gettext_test.go:24
+msgid "Hello, world!"
+msgstr "Hallo, Welt!"
diff --git a/_examples/es_MX.utf8/LC_MESSAGES/example.mo b/_examples/es_MX.utf8/LC_MESSAGES/example.mo
new file mode 100644
index 0000000..ce1ebca
--- /dev/null
+++ b/_examples/es_MX.utf8/LC_MESSAGES/example.mo
Binary files differ
diff --git a/_examples/es_MX.utf8/example.pot b/_examples/es_MX.utf8/example.pot
new file mode 100644
index 0000000..b490af0
--- /dev/null
+++ b/_examples/es_MX.utf8/example.pot
@@ -0,0 +1,37 @@
+# SOME DESCRIPTIVE TITLE.
+# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
+# This file is distributed under the same license as the PACKAGE package.
+# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
+#
+#, fuzzy
+msgid ""
+msgstr "Project-Id-Version: PACKAGE VERSION\n"
+ "Report-Msgid-Bugs-To: \n"
+ "POT-Creation-Date: 2012-10-06 15:47-0500\n"
+ "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
+ "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
+ "Language-Team: LANGUAGE <LL@li.org>\n"
+ "Language: \n"
+ "MIME-Version: 1.0\n"
+ "Content-Type: text/plain; charset=UTF-8\n"
+ "Content-Transfer-Encoding: 8bit\n"
+ "Plural-Forms: nplurals=INTEGER; plural=EXPRESSION;\n"
+
+#: gettext_test.go:32 gettext_test.go:40
+#, c-format
+msgid "An apple"
+msgid_plural "%d apples"
+msgstr[0] "Una manzana"
+msgstr[1] "%d manzanas"
+
+#: gettext_test.go:56
+msgid "Good bye!"
+msgstr "¡Hasta luego!"
+
+#: gettext_test.go:48
+msgid "Good morning"
+msgstr "Buenos días"
+
+#: gettext_test.go:24
+msgid "Hello, world!"
+msgstr "¡Hola mundo!"
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!"))
+}
+