aboutsummaryrefslogtreecommitdiff
path: root/tests/functional/api-usage/gotext.go
diff options
context:
space:
mode:
authorEuAndreh <eu@euandre.org>2025-05-12 07:36:15 -0300
committerEuAndreh <eu@euandre.org>2025-05-12 10:31:18 -0300
commit80ae5eff35d4fe48953cb5e61f929f765ab7cd0f (patch)
tree8037182f336a421de927138f5c562015023c38fe /tests/functional/api-usage/gotext.go
parentmv po/* po/doc/ (diff)
downloadgotext-80ae5eff35d4fe48953cb5e61f929f765ab7cd0f.tar.gz
gotext-80ae5eff35d4fe48953cb5e61f929f765ab7cd0f.tar.xz
Absorb gettext_test.go
Diffstat (limited to 'tests/functional/api-usage/gotext.go')
-rw-r--r--tests/functional/api-usage/gotext.go64
1 files changed, 64 insertions, 0 deletions
diff --git a/tests/functional/api-usage/gotext.go b/tests/functional/api-usage/gotext.go
index 36d1327..7ea7119 100644
--- a/tests/functional/api-usage/gotext.go
+++ b/tests/functional/api-usage/gotext.go
@@ -1,4 +1,68 @@
package gotext
+import (
+ "os"
+
+ g "gobang"
+)
+
+
+
func MainTest() {
+ g.Init()
+ Init("tests", "locale/")
+
+ g.Testing("Español", func() {
+ os.Setenv("LANGUAGE", "es_MX.UTF-8")
+ SetLocale(LC_ALL, "")
+
+ g.TAssertEqual(Gettext("Hello, world!"), "¡Hola, mundo!")
+ g.TAssertEqual(Gettext("Good morning"), "Buenos días")
+ g.TAssertEqual(Gettext("Good bye!"), "¡Hasta luego!")
+ g.TAssertEqual(Sprintf(
+ NGettext("An apple", "%d apples", 1),
+ 1,
+ "garbage",
+ ), "Una manzana")
+ g.TAssertEqual(Sprintf(
+ NGettext("An apple", "%d apples", 3),
+ 3,
+ ), "3 manzanas")
+ })
+
+ g.Testing("Deutsch", func() {
+ os.Setenv("LANGUAGE", "de_DE.UTF-8")
+ SetLocale(LC_ALL, "")
+
+ g.TAssertEqual(Gettext("Hello, world!"), "Hallo, Welt!")
+ g.TAssertEqual(Gettext("Good morning"), "Guten Morgen")
+ g.TAssertEqual(Gettext("Good bye!"), "Auf Wiedersehen!")
+ g.TAssertEqual(Sprintf(
+ NGettext("An apple", "%d apples", 1),
+ 1,
+ "garbage",
+ ), "Ein Apfel")
+ g.TAssertEqual(Sprintf(
+ NGettext("An apple", "%d apples", 3),
+ 3,
+ ), "3 Äpfel")
+ })
+
+ g.Testing("Français", func() {
+ os.Setenv("LANGUAGE", "fr_FR.UTF-8")
+ SetLocale(LC_ALL, "")
+
+ g.TAssertEqual(Gettext("Hello, world!"), "Hello, world!")
+ g.TAssertEqual(Gettext("Good morning"), "Good morning")
+ g.TAssertEqual(Gettext("Good bye!"), "Good bye!")
+ g.TAssertEqual(Sprintf(
+ NGettext("An apple", "%d apples", 1),
+ 1,
+ "garbage",
+ ), "An apple")
+ g.TAssertEqual(Sprintf(
+ NGettext("An apple", "%d apples", 3),
+ 3,
+ ), "3 apples")
+ })
}