Gets the jQuery timeago locale file based on the current Yii language

@return bool|string Returns the path to the locale file, or FALSE if
it does not exist.
320851
public static function getTimeAgoI18n($locale)
    {
        $pattern = 'locales/jquery.timeago.%s.js';

        $filename = sprintf($pattern, $locale);
        if (file_exists(Yii::getAlias(self::$assetsDirectory) . $filename)) {
            return $filename;
        } else { // try harder by shortening the locale
            $locale = substr($locale, 0, 2);
            $filename = sprintf($pattern, $locale);
            if (file_exists(Yii::getAlias(self::$assetsDirectory) . $filename)) {
                return $filename;
            }
        }
        return false;
    }
1134201
public function get(): Locale
    {
        $locale = $this->originalLocale;

        $convert_locales = $this->config->get('convert_locales');
        $conversions = $this->config->get('convert_locales_to', []);

        if ('auto' === $convert_locales) {
            $locale = isset($conversions[$locale->get()])
                ? Locale::from($conversions[$locale->get()])
                : $locale->withoutRegion();
        } elseif (true === $convert_locales && isset($conversions[$locale->get()])) {
            $locale = Locale::from($conversions[$locale->get()]);
        }

        return $locale;
    }
1141480
public function getServerSource()
    {
        return $this->getFile() ? Yii::$app->storage->fileServerPath($this->systemFileName) : false;
    }
1161595
public static function disableLocale():bool
    {
        $file = JsonListener::open(FEnv::get("framework.config.core.config.file"));
        if (true === property_exists($file, "locale_enabled") && true === $file->locale_enabled) {
            $file->locale_enabled = false;
            JsonListener::put(
                FEnv::get("framework.config.core.config.file"),
                json_encode($file, JSON_PRETTY_PRINT)
            );
            JsonListener::close(FEnv::get("framework.config.core.config.file"));
            return (true);
        }
        return (false);
    }
1329956
public function booleanFormat()
    {
        return [
            self::BOOL_Y => Yii::t('yii', 'Yes', [], \Yii::$app->formatter->locale),
            self::BOOL_N => Yii::t('yii', 'No', [], \Yii::$app->formatter->locale),
        ];
    }
248795
private function getLL()
    {
        if ($this->ll === null) {
            $this->ll = $GLOBALS['LANG']->includeLLFile(
                $this->getExtPath() . 'Resources/Private/Language/' . $this->langFile,
                false
            );
        }

        return $this->ll;
    }
1102781
public function setCurrentLocaleByContext()
    {
        if (function_exists('apply_filters')) {
            // Give a chance for plugins to override this decision
            $locale = null;
            $locale = apply_filters('strata_i18n_set_current_locale_by_context', $locale);
            if (!is_null($locale)) {
                return $this->setLocale($locale);
            }
        }

        if (!is_null($this->currentLocale)) {
            return $this->currentLocale;
        }

        $request = new Request();

        // Under ajax, one could post the value.
        if (Router::isAjax() && $request->hasPost("locale")) {
            $locale = $this->getLocaleByCode($request->post("locale"));
            if (!is_null($locale)) {
                return $this->setLocale($locale);
            }
        }

        if ($request->hasGet("locale")) {
            $locale = $this->getLocaleByCode($request->get("locale"));
            if (!is_null($locale)) {
                return $this->setLocale($locale);
            }
        }

        $inAdmin = function_exists('is_admin') ? is_admin() : false;
        if (!$inAdmin) {
            // This validates all locales but the default one
            $urls = implode('|', $this->getLocaleRegexUrls());

            if (array_key_exists('REQUEST_URI', (array)$_SERVER)) {
                if (preg_match('/^\/('.$urls.')\//i', $_SERVER['REQUEST_URI'], $match)) {
                    $locale = $this->getLocaleByUrl($match[1]);
                    if (!is_null($locale)) {
                        return $this->setLocale($locale);
                    }
                // Also validates for lack of locale code, meaning
                // a possible default locale match when no ajax-ing.
                } elseif (preg_match('/^(?:(?!'.$urls.'))\/?/i', $_SERVER['REQUEST_URI'])) {
                    $locale = $this->getDefaultLocale();
                    if (!is_null($locale)) {
                        return $this->setLocale($locale);
                    }
                }
            }
        }

        if ($this->hasLocaleInSession()) {
            $locale = $this->getLocaleInSession();
            if (!is_null($locale)) {
                return $this->setLocale($locale);
            }
        }

        if ($this->hasDefaultLocale()) {
            return $this->setLocale($this->getDefaultLocale());
        }
    }
1222199
public function getLocale() : ?string 
    {
        if ( ! $this->hasLocale()) {
            $this->setLocale($this->getDefaultLocale());
        }
        return $this->locale;
    }
522964
public function enqueue_jquery_ui_i18n() {

		static $done = array();

		$types = array();

		switch ( static::$type ) {
			case 'time':
				$types[] = 'time';

				break;
			case 'date':
				$types[] = 'date';

				break;
			case 'datetime':
				$types[] = 'time';
				$types[] = 'date';

				break;
		}

		if ( in_array( 'date', $types, true ) && ! in_array( 'date', $done, true ) ) {
			if ( function_exists( 'wp_localize_jquery_ui_datepicker' ) ) {
				wp_localize_jquery_ui_datepicker();
			}

			$done[] = 'date';
		}

		if ( in_array( 'time', $types, true ) && ! in_array( 'time', $done, true ) ) {
			$locale = str_replace( '_', '-', get_locale() );

			// Local files.
			if ( ! file_exists( PODS_DIR . 'ui/js/timepicker/i18n/jquery-ui-timepicker-' . $locale . '.js' ) ) {
				// Fallback to the base language (non-region specific).
				$locale = substr( $locale, 0, strpos( $locale, '-' ) );
			}

			if ( ! wp_script_is( 'jquery-ui-timepicker-i18n-' . $locale, 'registered' ) && file_exists( PODS_DIR . 'ui/js/timepicker/i18n/jquery-ui-timepicker-' . $locale . '.js' ) ) {
				wp_enqueue_script( 'jquery-ui-timepicker-i18n-' . $locale, PODS_URL . 'ui/js/timepicker/i18n/jquery-ui-timepicker-' . $locale . '.js', array( 'jquery-ui-timepicker' ), '1.6.3' );
			}

			$done[] = 'time';
		}
	}
1331216
static function fetchLocaleList()
    {
        $languages = eZContentLanguage::fetchList();
        $localeList = array();

        foreach ( $languages as $language )
        {
            $localeList[] = $language->attribute( 'locale' );
        }

        return $localeList;
    }
286240
private function getLocale() : string
  {
    $locale = ($this->locale ?? config('faker.locale.default'));

    if (
      $locale !== null &&
      is_array(config('faker.locale.supported')) &&
      in_array(config('faker.locale.default'), config('faker.locale.supported'))
    ) {
      return $locale;
    }

    return 'en_US';
  }
262677
private function getBrowserLanguageOrDefault()
    {
        if ($browserLanguage = getenv('HTTP_ACCEPT_LANGUAGE')) {
            $browserLocale = substr($browserLanguage, 0, 2);
            if (in_array($browserLocale, TypiCMS::enabledLocales())) {
                return $browserLocale;
            }
        }

        return config('app.locale');
    }
556472
public function DefaultLocale()
    {
        // Return explicit default locale
        if ($this->DefaultLocaleID) {
            $locale = Locale::getCached()->byID($this->DefaultLocaleID);
            if ($locale) {
                return $locale;
            }
        }

        // Use IsGlobalDefault if this is a member of this locale, or the first in the list of children
        $locales = Locale::getCached()->filter('DomainID', $this->ID);
        return $locales->filter('IsGlobalDefault', 1)->first()
            ?: $locales->first();
    }
1116070
private function _getSourceLanguage()
    {
        $languageSourceSearch = Yii::$app->request->get('LanguageSourceSearch', []);

        return isset($languageSourceSearch['source']) ? $languageSourceSearch['source'] : Yii::$app->sourceLanguage;
    }
956361
public static function get_locale()
    {
        if (!self::$current_locale) {
            self::$current_locale = i18n::config()->uninherited('default_locale');
        }
        return self::$current_locale;
    }
836406
public function getCountry()
    {
        if (strstr(Yii::app()->language, '_')) {
            return substr(strstr(Yii::app()->language, '_'), 1);
        } else {
            return null;
        }
    }
1265189
public function getTimeAgo($field = null, $options = []){
        $attribute = $this->attribute;
        if ($field !== null) {
            $attribute = $field;
        }

        $year  = $options['year'] ??  'full:{day} {month} {year}';
        $month = $options['month'] ?? 'full:{day} {month}';

        if ($this->owner->hasAttribute($attribute)) {
            $value = $this->owner{$attribute};
            if (!is_numeric($this->owner{$attribute})) {
                $value = strtotime($this->owner{$attribute});
            }
            $updatedM  = date('m', $value);
            $currM     = date('m', time());
            $updatedY  = date('Y', $value);
            $currY     = date('Y', time());

            if ($updatedY !== $currY) {
                return Html::tag('time', Yii::$app->formatter->asDate($value, 'long'));
            }
            if ($updatedM < $currM) {
                return Html::tag('time', Yii::$app->formatter->asDate($value, 'medium'));
            }
            return TimeAgo::widget(['timestamp' => $value, 'language' => Yii::$app->language]);
        }
        return null;
    }