public static function getLanguages($languages, $owner)
    {
        if (!$languages && isset(Yii::$app->params['languages'])) {
            $languages = Yii::$app->params['languages'];
        }

        if (!is_array($languages) || empty($languages)) {
            throw new InvalidConfigException('Please specify array of available languages in the '
            . get_class($owner) . ' or in the application parameters');
        }

        return $languages;
    }