Add the fallback locale

@param  string $locale
@param  bool   $preinit
@return Translator
483229
public function addFallbackLocale($locale, $preinit = false) {
		$locale = (string) $locale;
		$locale = $this->normalizeLocale($locale);
		
		if (in_array($locale, $this->fallbackLocales, true)) {
			return $this;
		}
		
		$this->fallbackLocales[] = $locale;
		
		if ($preinit) {
			$this->addPreinitLocale($locale);
		}
		
		return $this;
	}
182272
public function getLocaleChain(Locale $locale)
    {
        $fallbackRule = $this->configuration->getFallbackRule();
        $localeChain = [(string)$locale => $locale];

        if ($fallbackRule['strict'] === true) {
            foreach ($fallbackRule['order'] as $localeIdentifier) {
                $localeChain[$localeIdentifier] = new Locale($localeIdentifier);
            }
        } else {
            $locale = $this->findBestMatchingLocale($locale);
            while ($locale !== null) {
                $localeChain[(string)$locale] = $locale;
                $locale = $this->getParentLocaleOf($locale);
            }
            foreach ($fallbackRule['order'] as $localeIdentifier) {
                $locale = new Locale($localeIdentifier);
                $locale = $this->findBestMatchingLocale($locale);
                while ($locale !== null) {
                    $localeChain[(string)$locale] = $locale;
                    $locale = $this->getParentLocaleOf($locale);
                }
            }
        }
        $locale = $this->configuration->getDefaultLocale();
        $localeChain[(string)$locale] = $locale;

        return $localeChain;
    }
41699
public static function localeHasDiffTwoDayWords($locale)
    {
        return static::executeWithLocale($locale, function ($newLocale, TranslatorInterface $translator) {
            return $newLocale &&
                $translator->trans('diff_before_yesterday') !== 'diff_before_yesterday' &&
                $translator->trans('diff_after_tomorrow') !== 'diff_after_tomorrow';
        });
    }
591944
public function setLocale($locale)
    {
        if ($locale instanceof Locale) {
            $this->locale = $locale;
            return $this;
        }
        $this->locale = strtolower($locale);
        return $this;
    }
1360801
protected function buildInitialTranslations(LocaleEntity $locale, \Concrete\Core\Database\Driver\PDOStatement $rs)
    {
        $approvedSupport = $this->app->make(Access::class)->getLocaleAccess($locale) >= Access::ADMIN;
        $result = [];
        $numPlurals = $locale->getPluralCount();
        while (($row = $rs->fetch()) !== false) {
            $item = [
                'id' => (int) $row['id'],
                'original' => $row['text'],
            ];
            if ($approvedSupport && $row['approved']) {
                $item['isApproved'] = true;
            }
            if ($row['context'] !== '') {
                $item['context'] = $row['context'];
            }
            $isPlural = $row['plural'] !== '';
            if ($isPlural) {
                $item['originalPlural'] = $row['plural'];
            }
            if ($row['text0'] !== null) {
                $translations = [];
                switch ($isPlural ? $numPlurals : 1) {
                    case 6:
                        $translations[] = $row['text5'];
                        /* @noinspection PhpMissingBreakStatementInspection */
                    case 5:
                        $translations[] = $row['text4'];
                        /* @noinspection PhpMissingBreakStatementInspection */
                    case 4:
                        $translations[] = $row['text3'];
                        /* @noinspection PhpMissingBreakStatementInspection */
                    case 3:
                        $translations[] = $row['text2'];
                        /* @noinspection PhpMissingBreakStatementInspection */
                    case 2:
                        $translations[] = $row['text1'];
                        /* @noinspection PhpMissingBreakStatementInspection */
                    case 1:
                        $translations[] = $row['text0'];
                        break;
                }
                $item['translations'] = array_reverse($translations);
            }
            $result[] = $item;
        }
        $rs->closeCursor();

        return $result;
    }
266705
private static function getFallbackList($locale)
    {
        $fallbackList = [];

        // Add different locale variations
        $fallbackList[] = strtolower(str_replace('_', '-', $locale));
        $fallbackList[] = str_replace('_', '-', $locale);
        $fallbackList[] = strtolower(str_replace('-', '_', $locale));
        $fallbackList[] = str_replace('-', '_', $locale);

        // Add plain language (without country)
        $fallbackList[] = explode('_', str_replace('-', '_', $locale))[0];

        // Remove unique and reset index
        $fallbackList = array_values(array_unique($fallbackList));

        return $fallbackList;
    }
254118
public function setDefaultLocale($locale) {

		$this->defaultLocale = $locale;

		if (NULL === $this->locale) {
			$this->setPhpDefaultLocale($locale);
		}

	}
463561
public static function setLocale($locale)
    {
        static::getDefaultLocale();
        Locale::setDefault($locale);
        if (isset(static::$_collection)) {
            static::translators()->setLocale($locale);
        }
    }
194425
public function setFallbackLocales(array $locales, $preinit = false) {
		$this->resetFallbackLocales();
		$this->addFallbackLocales($locales, $preinit);
		
		return $this;
	}
12474
public static function getLocaleFallbackList($locale, $fallbackLocale = '')
    {
        // Check arguments
        if (empty($locale)) {
            throw new InvalidArgumentException(__METHOD__ . ': The given locale is empty');
        }

        // Create a priority fallback list to check for different locale.
        // This list includes also generic language codes separated from locale in case
        // there is generic language fallback.
        // If the base language for current and fallback locale is the same, then the language code
        // goes in the end as final fallback.
        $fallbackList = [];

        // Get fallback for normal locale
        $fallbackList = array_merge($fallbackList, self::getFallbackList($locale));

        // Add fallback locale, if different
        if ($fallbackLocale != $locale) {
            $fallbackList = array_merge($fallbackList, self::getFallbackList($fallbackLocale));
        }

        return $fallbackList;
    }
81011
public function setLocale($locale)
    {
        if ($locale && !is_string($locale)) {
            throw new InvalidArgumentException("Invalid locale");
        }
        $this->locale = $locale;
        return $this;
    }
560723
public function locale(string $locale) : self
    {
        if ($this->validate and ! $locale) {
            throw new Exception("Open Graph: Invalid locale (none set)");
        }

        $this->forget('locale');

        $this->tags[] = $this->createTag('locale', $locale);

        return $this;
    }
698956
public function setLocale($locale = null)
    {
        if ($locale === null) {
            $this->_locale = null;
            return $this;
        }

        include_once 'Zend/Locale.php';
        if (!Zend_Locale::isLocale($locale, true)) {
            if (!Zend_Locale::isLocale($locale, false)) {
                include_once 'Zend/Validate/Exception.php';
                throw new Zend_Validate_Exception("The locale '$locale' is no known locale");
            }

            $locale = new Zend_Locale($locale);
        }

        $this->_locale = (string) $locale;
        return $this;
    }
908615
public void addLocale(final LocaleId locale) {
        synchronized (this.locales) {
            if (this.locales == null) {
                this.locales = new ArrayList<LocaleId>();
            }
            this.locales.add(locale);
        }
    }
637658
public function addPriorityLocale(PriorityLocale $locale)
    {
        $this->priorityLocaleList[$locale->getLocale()] = $locale->getLocaleList();

        return $this;
    }
663103
public function getNewTranslation($locale)
    {
        $modelName = $this->getTranslationModelName();
        $translation = new $modelName();
        $translation->setAttribute($this->getLocaleKey(), $locale);
        $this->translations->add($translation);

        return $translation;
    }
809401
protected function fixLocale($locale)
    {
        if (in_array($locale, $this->supportedLocales)) {
            return $locale;
        }

        if (($short = Fixer::getLanguageFromLocale($locale)) !== $locale) {
            if (in_array($short, $this->supportedLocales)) {
                return $short;
            }
        }

        // If no better locale found...
        return $locale;
    }