Add arabic translation test. See #25

This commit is contained in:
Leonel Quinteros
2018-08-14 11:01:14 -03:00
parent 8e9d9df2e2
commit 302c88af99
3 changed files with 22 additions and 1 deletions

View File

@@ -0,0 +1,6 @@
msgid ""
msgstr ""
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
msgid "Alcohol & Tobacco"
msgstr "الكحول والتبغ"

View File

@@ -471,3 +471,17 @@ func TestAddTranslator(t *testing.T) {
t.Errorf("Expected 'en_US' but got '%s'", tr)
}
}
func TestArabicTranslation(t *testing.T) {
// Create Locale
l := NewLocale("fixtures/", "ar")
// Add domain
l.AddDomain("categories")
// Get translation
tr := l.GetD("categories", "Alcohol & Tobacco")
if tr != "الكحول والتبغ" {
t.Errorf("Expected to get 'الكحول والتبغ', but got '%s'", tr)
}
}

View File

@@ -5,7 +5,8 @@
package gotext
// Translator interface is used by Locale and Po objects
// Translator interface is used by Locale and Po objects.Translator
// It contains all methods needed to parse translation sources and obtain corresponding translations.
type Translator interface {
ParseFile(f string)
Parse(buf []byte)