TranslateableBehavior.php
public function getFallbackLanguage($forLanguage = null)
    {
        if ($this->_fallbackLanguage === null) {
            $this->_fallbackLanguage = Yii::$app->sourceLanguage;
        }
        if ($forLanguage === null) {
            return $this->_fallbackLanguage;
        }
        if ($this->_fallbackLanguage === false) {
            return $forLanguage;
        }

        if (is_array($this->_fallbackLanguage)) {
            if (isset($this->_fallbackLanguage[$forLanguage])) {
                return $this->_fallbackLanguage[$forLanguage];
            }
            // check fallback de-DE -> de
            $fallbackLanguage = substr($forLanguage, 0, 2);
            if ($forLanguage !== $fallbackLanguage) {
                return $fallbackLanguage;
            }
            // when no fallback is available, use the first defined fallback
            return reset($this->_fallbackLanguage);
        }

        // check fallback de-DE -> de
        $fallbackLanguage = substr($forLanguage, 0, 2);
        if ($forLanguage !== $fallbackLanguage) {
            return $fallbackLanguage;
        }
        return $this->_fallbackLanguage;
    }
public function getFallbackLanguage($forLanguage = null)
    {
        if ($this->_fallbackLanguage === null) {
            $this->_fallbackLanguage = Yii::$app->sourceLanguage;
        }
        if ($forLanguage === null) {
            return $this->_fallbackLanguage;
        }
        if ($this->_fallbackLanguage === false) {
            return $forLanguage;
        }

        if (is_array($this->_fallbackLanguage)) {
            if (isset($this->_fallbackLanguage[$forLanguage])) {
                return $this->_fallbackLanguage[$forLanguage];
            }
            // check fallback de-DE -> de
            $fallbackLanguage = substr($forLanguage, 0, 2);
            if ($forLanguage !== $fallbackLanguage) {
                return $fallbackLanguage;
            }
            // when no fallback is available, use the first defined fallback
            return reset($this->_fallbackLanguage);
        }

        // check fallback de-DE -> de
        $fallbackLanguage = substr($forLanguage, 0, 2);
        if ($forLanguage !== $fallbackLanguage) {
            return $fallbackLanguage;
        }
        return $this->_fallbackLanguage;
    }
public function getFallbackLanguage ( $ forLanguage = null ) { if ( $ this -> _fallbackLanguage === null ) { $ this -> _fallbackLanguage = Yii :: $ app -> sourceLanguage ; } if ( $ forLanguage === null ) { return $ this -> _fallbackLanguage ; } if ( $ this -> _fallbackLanguage === false ) { return $ forLanguage ; } if ( is_array ( $ this -> _fallbackLanguage ) ) { if ( isset ( $ this -> _fallbackLanguage [ $ forLanguage ] ) ) { return $ this -> _fallbackLanguage [ $ forLanguage ] ; } // check fallback de-DE -> de $ fallbackLanguage = substr ( $ forLanguage , 0 , 2 ) ; if ( $ forLanguage !== $ fallbackLanguage ) { return $ fallbackLanguage ; } // when no fallback is available, use the first defined fallback return reset ( $ this -> _fallbackLanguage ) ; } // check fallback de-DE -> de $ fallbackLanguage = substr ( $ forLanguage , 0 , 2 ) ; if ( $ forLanguage !== $ fallbackLanguage ) { return $ fallbackLanguage ; } return $ this -> _fallbackLanguage ; }
Returns current models' fallback language. If null, will return app's configured source language.
@return string
Returns current models fallback language . If null will return app s configured source language .