Returns a translated list of month names

@param bool $leadingZero Whether to generate month keys with leading zero.
@return array
9902
protected function _getMonthNames($leadingZero = false)
    {
        $months = [
            '01' => __d('cake', 'January'),
            '02' => __d('cake', 'February'),
            '03' => __d('cake', 'March'),
            '04' => __d('cake', 'April'),
            '05' => __d('cake', 'May'),
            '06' => __d('cake', 'June'),
            '07' => __d('cake', 'July'),
            '08' => __d('cake', 'August'),
            '09' => __d('cake', 'September'),
            '10' => __d('cake', 'October'),
            '11' => __d('cake', 'November'),
            '12' => __d('cake', 'December'),
        ];

        if ($leadingZero === false) {
            $i = 1;
            foreach ($months as $key => $name) {
                unset($months[$key]);
                $months[$i++] = $name;
            }
        }

        return $months;
    }
1037047
public function monthToString($month, $abbr = false)
	{
		switch ($month)
		{
			case 1:
				return $abbr ? \Lang::txt('JANUARY_SHORT') : \Lang::txt('JANUARY');
			case 2:
				return $abbr ? \Lang::txt('FEBRUARY_SHORT') : \Lang::txt('FEBRUARY');
			case 3:
				return $abbr ? \Lang::txt('MARCH_SHORT') : \Lang::txt('MARCH');
			case 4:
				return $abbr ? \Lang::txt('APRIL_SHORT') : \Lang::txt('APRIL');
			case 5:
				return $abbr ? \Lang::txt('MAY_SHORT') : \Lang::txt('MAY');
			case 6:
				return $abbr ? \Lang::txt('JUNE_SHORT') : \Lang::txt('JUNE');
			case 7:
				return $abbr ? \Lang::txt('JULY_SHORT') : \Lang::txt('JULY');
			case 8:
				return $abbr ? \Lang::txt('AUGUST_SHORT') : \Lang::txt('AUGUST');
			case 9:
				return $abbr ? \Lang::txt('SEPTEMBER_SHORT') : \Lang::txt('SEPTEMBER');
			case 10:
				return $abbr ? \Lang::txt('OCTOBER_SHORT') : \Lang::txt('OCTOBER');
			case 11:
				return $abbr ? \Lang::txt('NOVEMBER_SHORT') : \Lang::txt('NOVEMBER');
			case 12:
				return $abbr ? \Lang::txt('DECEMBER_SHORT') : \Lang::txt('DECEMBER');
		}
	}
540163
public function getFrenchMonths() {
        $months = array(
            1 => 'Janvier', 'Février', 'Mars', 'Avril', 'Mai', 'Juin', 'Juillet', 'Août', 'Septembre', 'Octobre', 'Novembre', 'Décembre'
        );
        return $months;
    }
325026
public static function getAll() : array
    {
        $months = [];

        for ($month = Month::JANUARY; $month <= Month::DECEMBER; $month++) {
            $months[] = Month::get($month);
        }

        return $months;
    }
469401
protected function getMonthlyOccurrences()
    {
        $startDate = clone $this->currentDate;

        $byDayResults = [];

        // Our strategy is to simply go through the byDays, advance the date to
        // that point and add it to the results.
        if ($this->byDay) {
            foreach ($this->byDay as $day) {
                $dayName = $this->dayNames[$this->dayMap[substr($day, -2)]];

                // Dayname will be something like 'wednesday'. Now we need to find
                // all wednesdays in this month.
                $dayHits = [];

                // workaround for missing 'first day of the month' support in hhvm
                $checkDate = new \DateTime($startDate->format('Y-m-1'));
                // workaround modify always advancing the date even if the current day is a $dayName in hhvm
                if ($checkDate->format('l') !== $dayName) {
                    $checkDate = $checkDate->modify($dayName);
                }

                do {
                    $dayHits[] = $checkDate->format('j');
                    $checkDate = $checkDate->modify('next '.$dayName);
                } while ($checkDate->format('n') === $startDate->format('n'));

                // So now we have 'all wednesdays' for month. It is however
                // possible that the user only really wanted the 1st, 2nd or last
                // wednesday.
                if (strlen($day) > 2) {
                    $offset = (int) substr($day, 0, -2);

                    if ($offset > 0) {
                        // It is possible that the day does not exist, such as a
                        // 5th or 6th wednesday of the month.
                        if (isset($dayHits[$offset - 1])) {
                            $byDayResults[] = $dayHits[$offset - 1];
                        }
                    } else {
                        // if it was negative we count from the end of the array
                        // might not exist, fx. -5th tuesday
                        if (isset($dayHits[count($dayHits) + $offset])) {
                            $byDayResults[] = $dayHits[count($dayHits) + $offset];
                        }
                    }
                } else {
                    // There was no counter (first, second, last wednesdays), so we
                    // just need to add the all to the list).
                    $byDayResults = array_merge($byDayResults, $dayHits);
                }
            }
        }

        $byMonthDayResults = [];
        if ($this->byMonthDay) {
            foreach ($this->byMonthDay as $monthDay) {
                // Removing values that are out of range for this month
                if ($monthDay > $startDate->format('t') ||
                $monthDay < 0 - $startDate->format('t')) {
                    continue;
                }
                if ($monthDay > 0) {
                    $byMonthDayResults[] = $monthDay;
                } else {
                    // Negative values
                    $byMonthDayResults[] = $startDate->format('t') + 1 + $monthDay;
                }
            }
        }

        // If there was just byDay or just byMonthDay, they just specify our
        // (almost) final list. If both were provided, then byDay limits the
        // list.
        if ($this->byMonthDay && $this->byDay) {
            $result = array_intersect($byMonthDayResults, $byDayResults);
        } elseif ($this->byMonthDay) {
            $result = $byMonthDayResults;
        } else {
            $result = $byDayResults;
        }
        $result = array_unique($result);
        sort($result, SORT_NUMERIC);

        // The last thing that needs checking is the BYSETPOS. If it's set, it
        // means only certain items in the set survive the filter.
        if (!$this->bySetPos) {
            return $result;
        }

        $filteredResult = [];
        foreach ($this->bySetPos as $setPos) {
            if ($setPos < 0) {
                $setPos = count($result) + ($setPos + 1);
            }
            if (isset($result[$setPos - 1])) {
                $filteredResult[] = $result[$setPos - 1];
            }
        }

        sort($filteredResult, SORT_NUMERIC);

        return $filteredResult;
    }
795893
public static function lastMonthRange()
    {
        $begin = mktime(0, 0, 0, date('m') - 1, 1, date('Y'));
        $end = mktime(23, 59, 59, date('m') - 1, date('t', $begin), date('Y'));

        return [$begin, $end];
    }
78318
protected function getMonths()
    {
        $intSecondsPerMonth = ($this->isPositive()) ? DateTimeSpan::SECONDS_PER_MONTH : ((-1) * DateTimeSpan::SECONDS_PER_MONTH);
        $intMonths = floor($this->intSeconds / $intSecondsPerMonth);
        if ($this->isNegative()) {
            $intMonths = (-1) * $intMonths;
        }
        return $intMonths;
    }
134112
protected function monthNameNominativeCase(int $month, bool $leap_year): string
    {
        static $translated_month_names;

        if ($translated_month_names === null) {
            $translated_month_names = [
                0  => '',
                /* I18N: a month in the Jewish calendar */
                1  => I18N::translateContext('NOMINATIVE', 'Tishrei'),
                /* I18N: a month in the Jewish calendar */
                2  => I18N::translateContext('NOMINATIVE', 'Heshvan'),
                /* I18N: a month in the Jewish calendar */
                3  => I18N::translateContext('NOMINATIVE', 'Kislev'),
                /* I18N: a month in the Jewish calendar */
                4  => I18N::translateContext('NOMINATIVE', 'Tevet'),
                /* I18N: a month in the Jewish calendar */
                5  => I18N::translateContext('NOMINATIVE', 'Shevat'),
                /* I18N: a month in the Jewish calendar */
                6  => I18N::translateContext('NOMINATIVE', 'Adar I'),
                /* I18N: a month in the Jewish calendar */
                7  => I18N::translateContext('NOMINATIVE', 'Adar'),
                /* I18N: a month in the Jewish calendar */
                -7 => I18N::translateContext('NOMINATIVE', 'Adar II'),
                /* I18N: a month in the Jewish calendar */
                8  => I18N::translateContext('NOMINATIVE', 'Nissan'),
                /* I18N: a month in the Jewish calendar */
                9  => I18N::translateContext('NOMINATIVE', 'Iyar'),
                /* I18N: a month in the Jewish calendar */
                10 => I18N::translateContext('NOMINATIVE', 'Sivan'),
                /* I18N: a month in the Jewish calendar */
                11 => I18N::translateContext('NOMINATIVE', 'Tamuz'),
                /* I18N: a month in the Jewish calendar */
                12 => I18N::translateContext('NOMINATIVE', 'Av'),
                /* I18N: a month in the Jewish calendar */
                13 => I18N::translateContext('NOMINATIVE', 'Elul'),
            ];
        }

        if ($month === 7 && $leap_year) {
            return $translated_month_names[-7];
        }

        return $translated_month_names[$month];
    }
997939
function getDateTimeTranslations(localeData) {
  const dayNames = localeData.main(`dates/calendars/gregorian/days`);
  const monthNames = localeData.main(`dates/calendars/gregorian/months`);
  const erasNames = localeData.main(`dates/calendars/gregorian/eras`);
  const dayPeriods = getDayPeriodsAmPm(localeData);

  const dayPeriodsFormat = removeDuplicates([
    objectValues(dayPeriods.format.narrow),
    objectValues(dayPeriods.format.abbreviated),
    objectValues(dayPeriods.format.wide)
  ]);

  const dayPeriodsStandalone = removeDuplicates([
    objectValues(dayPeriods['stand-alone'].narrow),
    objectValues(dayPeriods['stand-alone'].abbreviated),
    objectValues(dayPeriods['stand-alone'].wide)
  ]);

  const daysFormat = removeDuplicates([
    objectValues(dayNames.format.narrow),
    objectValues(dayNames.format.abbreviated),
    objectValues(dayNames.format.wide),
    objectValues(dayNames.format.short)
  ]);

  const daysStandalone = removeDuplicates([
    objectValues(dayNames['stand-alone'].narrow),
    objectValues(dayNames['stand-alone'].abbreviated),
    objectValues(dayNames['stand-alone'].wide),
    objectValues(dayNames['stand-alone'].short)
  ]);

  const monthsFormat = removeDuplicates([
    objectValues(monthNames.format.narrow),
    objectValues(monthNames.format.abbreviated),
    objectValues(monthNames.format.wide)
  ]);

  const monthsStandalone = removeDuplicates([
    objectValues(monthNames['stand-alone'].narrow),
    objectValues(monthNames['stand-alone'].abbreviated),
    objectValues(monthNames['stand-alone'].wide)
  ]);

  const eras = removeDuplicates([
    [erasNames.eraNarrow['0'], erasNames.eraNarrow['1']],
    [erasNames.eraAbbr['0'], erasNames.eraAbbr['1']],
    [erasNames.eraNames['0'], erasNames.eraNames['1']]
  ]);

  const dateTimeTranslations = [
    ...removeDuplicates([dayPeriodsFormat, dayPeriodsStandalone]),
    ...removeDuplicates([daysFormat, daysStandalone]),
    ...removeDuplicates([monthsFormat, monthsStandalone]),
    eras
  ];

  return dateTimeTranslations;
}
787456
public static function get_list_of_timezones($currentvalue = null, $include99 = false) {
        self::init_zones();

        // Localise first.
        $timezones = array();
        foreach (self::$goodzones as $tzkey => $ignored) {
            $timezones[$tzkey] = self::get_localised_timezone($tzkey);
        }
        core_collator::asort($timezones);

        // Add '99' if requested.
        if ($include99 or $currentvalue == 99) {
            $timezones['99'] = self::get_localised_timezone('99');
        }

        if (!isset($currentvalue) or isset($timezones[$currentvalue])) {
            return $timezones;
        }

        if (is_numeric($currentvalue)) {
            // UTC offset.
            if ($currentvalue == 0) {
                $a = 'UTC';
            } else {
                $modifier = ($currentvalue > 0) ? '+' : '';
                $a = 'UTC' . $modifier . number_format($currentvalue, 1);
            }
            $timezones[$currentvalue] = get_string('timezoneinvalid', 'core_admin', $a);
        } else {
            // Some string we don't recognise.
            $timezones[$currentvalue] = get_string('timezoneinvalid', 'core_admin', $currentvalue);
        }

        return $timezones;
    }
518807
public function translateMonthsToEnglish(string $date)
    {
        foreach ($this->getMonthTranslationMap() as $english => $translated) {
            if (false !== strpos($date, $translated)) {
                $date = str_replace($translated, $english, $date);
            }
        }

        foreach ($this->getShortMonthTranslationMap() as $english => $translated) {
            if (false !== strpos($date, $translated)) {
                $date = str_replace($translated, $english, $date);
            }
        }

        return $date;
    }
1008661
public function getBestRenderLocales($ordered = self::ORDER_LANG) {
        $locales = [];
        $this->getServerLocales();

        foreach($this->getClientLocales() as $locale) {
            /** @var Locale $locale  */

            $loc = $this->serverLocales->getBestMatchingLocaleForLocale($locale);
            if($loc && !in_array($loc, $locales)) {
                $locales[]  = $loc;
            }
        }
        if(count($locales) == 0) {
            if($this->defaultLocale)
                $locales[] = $this->defaultLocale;
            else {
                $locales[] = $this->getServerLocales()[0] ?? NULL;
            }
        }

        if($ordered & self::ORDER_STRUCT) {
            $locs = [];
            foreach($locales as $loc) {
                /** @var Locale $loc */
                $lang = $loc->getLanguage();

                $locs[$lang][] = $loc;
            }

            if($ordered & self::ORDER_LANG) {
                foreach($locs as &$ll)
                    usort($ll, LocaleCollection::LANG_SORT_CALLBACK);
            } elseif($ordered & self::ORDER_REG) {
                foreach($locs as &$ll)
                    usort($ll, LocaleCollection::REG_SORT_CALLBACK);
            }

            return $locs;
        }

        return $locales;
    }
902180
private static function getMonthSequence(array $months, $target, $withCurrent)
    {
        if (!in_array($target, $months)) {
            throw new LogicException(
                sprintf('Target month "%s" is out of range. The range must be from 01 up to 12', $target)
            );
        }

        $collection = array();

        foreach ($months as $month) {
            if ($month == $target) {
                if ($withCurrent === true) {
                    $collection[] = $month;
                }
                break;
            } else {
                $collection[] = $month;
            }
        }

        return $collection;
    }
656575
function get_month_shortname($m="") {
  	if ($m=="") {
  		$m = $this->mdate("m");
 		}
		$dt = \DateTime::createFromFormat('!m', $m);
		return $dt->format('M');
 	}
977576
public static function monthStringToNumber($month)
    {
        $monthIndex = 1;
        foreach (self::$monthNames as $shortMonthName => $longMonthName) {
            if (($month === $longMonthName) || ($month === $shortMonthName)) {
                return $monthIndex;
            }
            ++$monthIndex;
        }
        return $month;
    }
1180511
public function monthInput($options = []) {
	$defaultOptions = [
		'id' => self::MONTH_ID,
		'class' => 'form-control',
		'autocomplete' => self::AUTO_MONTH_ATTR,
		'placeholder' => '••',
		'required' => true,
		'type' => 'tel',
		'maxlength' => 2,
		'size' => 2
	];
	$mergedOptions = array_merge($defaultOptions, $options);
	StripeHelper::secCheck($mergedOptions);
	$mergedOptions['data-stripe'] = self::MONTH_ID;
	return Html::input('text', null, null, $mergedOptions);
    }
1371734
public static function getLocalMonthName($date, $short=false) {
		if(empty($date))
			return false;
		
		$month = date('m', strtotime($date));

		$bulan = array('Januari', 'Februari', 'Maret', 'April', 'Mei', 'Juni', 'Juli', 'Agustus', 'September', 'Oktober', 'November', 'Desember');
		$shortBulan = array('Jan', 'Feb', 'Mar', 'Apr', 'Mei', 'Jun', 'Jul', 'Agu', 'Sep', 'Okt', 'Nov', 'Des');

		if($short == true)
			return $shortBulan[$month-1];
		else
			return $bulan[$month-1];
	}