Skip to content

Commit

Permalink
Fixed #279
Browse files Browse the repository at this point in the history
  • Loading branch information
AntonShevchuk authored and AntonShevchuk committed Nov 7, 2014
1 parent f0312f6 commit 86db723
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/Translator/Translator.php
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,10 @@ public function addTextDomain($domain, $path)
*/
public static function translate($message)
{
if (empty($message)) {
return $message;
}

if (function_exists('gettext')) {
$message = gettext($message);
}
Expand Down
2 changes: 2 additions & 0 deletions tests/src/Translator/TranslatorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ public function testTranslate()
$translator->setLocale('uk_UA');
$translator->setPath(PATH_APPLICATION .'/locale');

$this->assertEquals('', $translator->translate(''));
$this->assertEquals('message', $translator->translate('message'));
}

Expand All @@ -56,6 +57,7 @@ public function testPluralTranslate()
$translator->setLocale('uk_UA');
$translator->setPath(PATH_APPLICATION .'/locale');

$this->assertEquals('', $translator->translatePlural('', '', 2));
$this->assertEquals('messages', $translator->translatePlural('message', 'messages', 2));
}

Expand Down

0 comments on commit 86db723

Please sign in to comment.