@param string $language

@return Section|false
512312
public static function getByLocale($locale, Site $site = null)
    {
        if (!$site) {
            $site = \Core::make('site')->getSite();
        }
        if ($locale) {
            if (!is_object($locale)) {
                $locale = explode('_', $locale);
                if (!isset($locale[1])) {
                    $locale[1] = '';
                }
                $em = Database::get()->getEntityManager();
                $locale = $em->getRepository('Concrete\Core\Entity\Site\Locale')
                    ->findOneBy(['site' => $site, 'msLanguage' => $locale[0], 'msCountry' => $locale[1]]);
            }

            if (is_object($locale)) {
                $obj = parent::getByID($locale->getSiteTree()->getSiteHomePageID(), 'RECENT');
                $obj->setLocale($locale);

                return $obj;
            }
        }

        return false;
    }
262270
private function getFlexLocale($language) {
        if(!empty($language))
        {
            $split = explode("-", $language, 2);

            if(count($split) == 2 && $split[1] != "") {
                $split[1] = strtoupper($split[1]);
            } else {
                $split = null;
            }
        }

        if(empty($split))
            $split = ['en', 'US'];

        return $split[0] . self::LANGUAGUE_SEPARATOR . $split[1];
    }
1054946
public function getTranslationByLang($language) {
        if ($language instanceof Language) {
            $index = $language->getSymbol();
        } else {
            $index = $language;
        }
        if (empty($this->transArray[$index])) {
            $this->transArray[$index] = $this->getTranslations()->filter(function ($trans) use ($index) {
                                    return $trans->getTransLang()->getSymbol() == $index;
                            })
                    ->first();
        }

        return $this->transArray[$index];
    }
662999
public function forceLanguage($language) {
		$changeLanguage = false;
		// Check if the user set null to retrieve the initial language
		// If the initial language is already recovered fine don't require the file
		if($language === null) {
			// Save old language
			$language = $this->language;
			// Retrieve initial language
			$this->initLanguage();
			// Chekck if the language change
			if($this->language != $language) {
				$changeLanguage = true;
			}
		}
		// If the user ask a new language not set
		elseif($this->language != $language) {
			$this->language = $language;
			$changeLanguage = true;
		}
		
		// Empty all the old language
		if($changeLanguage) {
			$this->loadFile = array();
			$this->msg = null;
		}
	}
373721
public function hasTranslation($slug = false, $language = null)
    {
        return $this->hasTrans($slug, null, $language);
    }
623065
final protected function loadTranslations($language)
    {
        // Don't load the same language twice, if that's the case
        if ($this->appConfig->getLanguage() !== $language) {

            $this->appConfig->setLanguage($language);
            $this->loadTranslationMessages($language);
            return true;

        } else {
            return false;
        }
    }
871299
private function getMessageFile($language) {
		if(!isset($this->messageFile[$language])) {
			$this->messageFile[$language] = new MessageFileLanguage($this->getPath(), $language);
		}
		return $this->messageFile[$language];
	}
365787
static public function fetchTagsByKeyword( $keyword, $language = false )
    {
        if ( $language )
        {
            if ( !is_array( $language ) )
                $language = array( $language );
            eZContentLanguage::setPrioritizedLanguages( $language );
        }

        if ( strpos( $keyword, '*' ) !== false )
        {
            $keyword = preg_replace(
                array(
                    '#%#m',
                    '#(?<!\\\\)\\*#m',
                    '#(?<!\\\\)\\\\\\*#m',
                    '#\\\\\\\\#m'
                ),
                array(
                    '\\%',
                    '%',
                    '*',
                    '\\\\'
                ),
                $keyword
            );

            $keyword = array( 'like', $keyword );
        }

        $result = eZTagsObject::fetchByKeyword( $keyword );

        if ( $language )
            eZContentLanguage::clearPrioritizedLanguages();

        if ( is_array( $result ) && !empty( $result ) )
            return array( 'result' => $result );

        return array( 'result' => false );
    }
177878
public function withLanguage(string $language): self
    {
        $provider = clone $this;

        $provider->language = $this->getLanguage($language);

        return $provider;
    }
179676
public function getSlug($language = null)
    {
        $slugify = new Slugify();

        return $slugify->slugify($this->getTitle($language));
    }
902361
public function isRtl(string $language): bool
    {
        $result = false;

        // Simplify and verify, just in case
        $language = $this->localeToLanguage($language);
        if (in_array($language, $this->getRtl())) {
            $result = true;
        }

        return $result;
    }
1035986
protected function buildPathToArea($language = false)
    {
        $path = [];
        //language
        if($language) {
            $path[] = $language;
        } elseif(isset($this->route['parameters']['language'])) {
            $path[] = $this->route['parameters']['language'];
        }
        //area
        if(isset($this->route['parameters']['area'])) {
            $path[] = $this->route['parameters']['area'];
        }
        return $path;
    }
988574
public static String getLabel(Language lang,
								  Class<?> sectionClass,
								  String isInSection) {
		return getLabel(lang, sectionClass.getName(),  isInSection);
	}
405903
protected function lang($language)
    {
        $pos = array_search($language, $this->request->getAcceptLanguage());
        if ($pos === FALSE) {
            throw new NotAcceptableException('No matching method for response type "'.join(', ', $this->request->getAcceptLanguage()).'"');
        }
        return count($this->request->getAcceptLanguage()) - $pos;
    }
945227
public String getLanguageComponent(String language) {
        if (StringUtils.isNullOrEmpty(language)) {
            return "";
        }

        if (language.contains("-")) {
            return language.split("-")[0];
        } else if (language.contains("_")) {
            return language.split("_")[0];
        }

        return language;
    }
1230457
public function available($language = null)
    {
        return $this->node->getTree()->isPublished($this->node, $language);
    }
1283628
public static function get_smart_locale($language = null) {

		require_once FRAMEWORK_PATH . '/thirdparty/Zend/Locale.php';
		$locale = Zend_Locale::getBrowser();

		if(!$locale) {
			if($language) {
				return i18n::get_locale_from_lang($language);
			}
			else {
				return i18n::get_locale();
			}
		}

		$locale = array_keys($locale);
		$firstPref = array_shift($locale);

		if(strpos($firstPref, '_') === false) {
			return i18n::get_locale_from_lang($language);
		}

		return $firstPref;
	}