aboutsummaryrefslogtreecommitdiff
path: root/gettext_test.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 /gettext_test.go
parentmv po/* po/doc/ (diff)
downloadgotext-80ae5eff35d4fe48953cb5e61f929f765ab7cd0f.tar.gz
gotext-80ae5eff35d4fe48953cb5e61f929f765ab7cd0f.tar.xz
Absorb gettext_test.go
Diffstat (limited to 'gettext_test.go')
-rw-r--r--gettext_test.go67
1 files changed, 0 insertions, 67 deletions
diff --git a/gettext_test.go b/gettext_test.go
deleted file mode 100644
index a22bbc6..0000000
--- a/gettext_test.go
+++ /dev/null
@@ -1,67 +0,0 @@
-package gettext
-
-import (
- "os"
- "testing"
-
- "github.com/stretchr/testify/assert"
-)
-
-const (
- spanishMexico = "es_MX.utf8"
- deutschDeutschland = "de_DE.utf8"
- frenchFrance = "fr_FR.utf8"
-)
-
-// a setUp would be nice
-func init() {
- textDomain := "example"
- BindTextdomain(textDomain, "_examples/")
- Textdomain(textDomain)
-}
-
-func TestSpanish(t *testing.T) {
- os.Setenv("LANGUAGE", spanishMexico)
- SetLocale(LcAll, "")
-
- assert.Equal(t, "¡Hola mundo!", Gettext("Hello, world!"))
-
- assert.Equal(t, "Una manzana", Sprintf(NGettext("An apple", "%d apples", 1), 1, "garbage"))
-
- assert.Equal(t, "3 manzanas", Sprintf(NGettext("An apple", "%d apples", 3), 3))
-
- assert.Equal(t, "Buenos días", Gettext("Good morning"))
-
- assert.Equal(t, "¡Hasta luego!", Gettext("Good bye!"))
-}
-
-func TestDeutsch(t *testing.T) {
- os.Setenv("LANGUAGE", deutschDeutschland)
- SetLocale(LcAll, "")
-
- assert.Equal(t, "Hallo, Welt!", Gettext("Hello, world!"))
-
- assert.Equal(t, "Ein Apfel", Sprintf(NGettext("An apple", "%d apples", 1), 1, "garbage"))
-
- assert.Equal(t, "3 Äpfel", Sprintf(NGettext("An apple", "%d apples", 3), 3))
-
- assert.Equal(t, "Guten morgen", Gettext("Good morning"))
-
- assert.Equal(t, "Auf Wiedersehen!", Gettext("Good bye!"))
-}
-
-func TestFrench(t *testing.T) {
- // Note that we don't have a french translation.
- os.Setenv("LANGUAGE", frenchFrance)
- SetLocale(LcAll, "")
-
- assert.Equal(t, "Hello, world!", Gettext("Hello, world!"))
-
- assert.Equal(t, "An apple", Sprintf(NGettext("An apple", "%d apples", 1), 1, "garbage"))
-
- assert.Equal(t, "3 apples", Sprintf(NGettext("An apple", "%d apples", 3), 3))
-
- assert.Equal(t, "Good morning", Gettext("Good morning"))
-
- assert.Equal(t, "Good bye!", Gettext("Good bye!"))
-}