diff --git a/fixtures/ar/categories.po b/fixtures/ar/categories.po new file mode 100644 index 0000000..16b7718 --- /dev/null +++ b/fixtures/ar/categories.po @@ -0,0 +1,6 @@ +msgid "" +msgstr "" +"Plural-Forms: nplurals=2; plural=(n != 1);\n" + +msgid "Alcohol & Tobacco" +msgstr "الكحول والتبغ" diff --git a/locale_test.go b/locale_test.go index 21ae263..10cd1c1 100644 --- a/locale_test.go +++ b/locale_test.go @@ -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) + } +} diff --git a/translator.go b/translator.go index 58175b1..aa8687b 100644 --- a/translator.go +++ b/translator.go @@ -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)