Add arabic translation test. See #25
This commit is contained in:
6
fixtures/ar/categories.po
Normal file
6
fixtures/ar/categories.po
Normal file
@@ -0,0 +1,6 @@
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
|
||||
|
||||
msgid "Alcohol & Tobacco"
|
||||
msgstr "الكحول والتبغ"
|
||||
@@ -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)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user