Created
July 3, 2012 20:59
-
-
Save DASPRiD/3043035 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Check if a message is translated. | |
* | |
* @param string $message | |
* @param string $textDomain | |
* @param string $locale | |
* @return boolean | |
*/ | |
public function isTranslated($message, $textDomain = 'default', $locale = null) | |
{ | |
$locale = ($locale ?: $this->getLocale()); | |
$translation = $this->getTranslatedMessage($message, $locale, $textDomain); | |
if ($translation !== null && $translation !== '') { | |
return true; | |
} | |
if (null !== ($fallbackLocale = $this->getFallbackLocale()) | |
&& $locale !== $fallbackLocale | |
) { | |
return $this->isTranslated($message, $textDomain, $fallbackLocale); | |
} | |
return false; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment