TranslateableBehavior.php
private function getAttributeTranslation($attribute, $language)
    {
        $seen = [];
        do {
            $model = $this->getTranslation($language);
            $modelLanguage = $language;
            $fallbackLanguage = $this->getFallbackLanguage($language);
            $seen[$language] = true;
            if (isset($seen[$fallbackLanguage])) {
                // break infinite loop in fallback path
                return [$model->$attribute, $modelLanguage];
            }
            $language = $fallbackLanguage;
        } while($model->$attribute === null);
        return [$model->$attribute, $modelLanguage];
    }
private function getAttributeTranslation($attribute, $language)
    {
        $seen = [];
        do {
            $model = $this->getTranslation($language);
            $modelLanguage = $language;
            $fallbackLanguage = $this->getFallbackLanguage($language);
            $seen[$language] = true;
            if (isset($seen[$fallbackLanguage])) {
                // break infinite loop in fallback path
                return [$model->$attribute, $modelLanguage];
            }
            $language = $fallbackLanguage;
        } while($model->$attribute === null);
        return [$model->$attribute, $modelLanguage];
    }
private function getAttributeTranslation ( $ attribute , $ language ) { $ seen = [ ] ; do { $ model = $ this -> getTranslation ( $ language ) ; $ modelLanguage = $ language ; $ fallbackLanguage = $ this -> getFallbackLanguage ( $ language ) ; $ seen [ $ language ] = true ; if ( isset ( $ seen [ $ fallbackLanguage ] ) ) { // break infinite loop in fallback path return [ $ model -> $ attribute , $ modelLanguage ] ; } $ language = $ fallbackLanguage ; } while ( $ model -> $ attribute === null ) ; return [ $ model -> $ attribute , $ modelLanguage ] ; }
Retrieve translation for an attribute.
@param string $attribute the attribute name.
@param string $language the desired translation language.
@return array first element is the translation, second element is the language.
Language may differ from `$language` when a fallback translation has been used.
Retrieve translation for an attribute .