From 68c6afc56f3758154cfb96cba6fd48a6b5535590 Mon Sep 17 00:00:00 2001 From: ArthurHoaro Date: Mon, 26 Feb 2018 22:53:00 +0100 Subject: Load theme translations files automatically Fixes #1077 Take a look at the docs update to see how it works --- tests/LanguagesTest.php | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) (limited to 'tests/LanguagesTest.php') diff --git a/tests/LanguagesTest.php b/tests/LanguagesTest.php index 864ce630..4951e09a 100644 --- a/tests/LanguagesTest.php +++ b/tests/LanguagesTest.php @@ -175,6 +175,32 @@ class LanguagesTest extends \PHPUnit_Framework_TestCase $this->assertEquals($text, t($text)); } + /** + * Test t() with an extension language file coming from the theme in gettext mode + */ + public function testTranslationThemeExtensionGettext() + { + $this->conf->set('translation.mode', 'gettext'); + $this->conf->set('raintpl_tpl', 'tests/utils/customtpl/'); + $this->conf->set('theme', 'dummy'); + new Languages('en', $this->conf); + $txt = 'rooster'; // ignore me poedit + $this->assertEquals('rooster', t($txt, $txt, 1, 'dummy')); + } + + /** + * Test t() with an extension language file coming from the theme in PHP mode + */ + public function testTranslationThemeExtensionPhp() + { + $this->conf->set('translation.mode', 'php'); + $this->conf->set('raintpl_tpl', 'tests/utils/customtpl/'); + $this->conf->set('theme', 'dummy'); + new Languages('en', $this->conf); + $txt = 'rooster'; // ignore me poedit + $this->assertEquals('rooster', t($txt, $txt, 1, 'dummy')); + } + /** * Test t() with an extension language file in gettext mode */ -- cgit v1.2.3