Create localized versions of the units, week and month names
516680
def _initConstants(ptc):
    
      # build weekday offsets - yes, it assumes the Weekday and shortWeekday
      # lists are in the same order and Mon..Sun (Python style)
    ptc.WeekdayOffsets = {}

    o = 0
    for key in ptc.Weekdays:
        ptc.WeekdayOffsets[key] = o
        o += 1
    o = 0
    for key in ptc.shortWeekdays:
        ptc.WeekdayOffsets[key] = o
        o += 1

      # build month offsets - yes, it assumes the Months and shortMonths
      # lists are in the same order and Jan..Dec
    ptc.MonthOffsets = {}

    o = 1
    for key in ptc.Months:
        ptc.MonthOffsets[key] = o
        o += 1
    o = 1
    for key in ptc.shortMonths:
        ptc.MonthOffsets[key] = o
        o += 1
162966
function makeMoment(input, format, lang, strict, utc) {
    if (typeof lang === "boolean") {
        utc = strict;
        strict = lang;
        lang = undefined;
    }
    var itsJalaliDate = (isJalali(this));
    if(input && (typeof input === "string") && !format && itsJalaliDate && !moment.useGregorianParser) {
        input = input.replace(/\//g,"-");
        if(/\d{4}\-\d{2}\-\d{2}/.test(input)) {
            format = "jYYYY-jMM-jDD";
        } else if (/\d{4}\-\d{2}\-\d{1}/.test(input)) {
            format = "jYYYY-jMM-jD";
        } else if (/\d{4}\-\d{1}\-\d{1}/.test(input)) {
            format = "jYYYY-jM-jD";
        } else if (/\d{4}\-\d{1}\-\d{2}/.test(input)) {
            format = "jYYYY-jM-jDD";
        } else if (/\d{4}\-W\d{2}\-\d{2}/.test(input)) {
            format = "jYYYY-jW-jDD";
        } else if (/\d{4}\-\d{3}/.test(input)) {
            format = "jYYYY-jDDD";
        } else if (/\d{8}/.test(input)) {
            format = "jYYYYjMMjDD";
        } else if (/\d{4}W\d{2}\d{1}/.test(input)) {
            format = "jYYYYjWWjD";
        } else if (/\d{4}W\d{2}/.test(input)) {
            format = "jYYYYjWW";
        } else if (/\d{4}\d{3}/.test(input)) {
            format = "jYYYYjDDD";
        }
    }
    if (format && itsJalaliDate){
        format = toJalaliFormat(format);
    }
    if (format && typeof format === "string"){
        format = fixFormat(format, moment);
    }

    var config =
        { _i: input
            , _f: format
            , _l: lang
            , _strict: strict
            , _isUTC: utc
        }
        , date
        , m
        , jm
        , origInput = input
        , origFormat = format;
    if (format) {
        if (isArray(format)) {
            return makeDateFromStringAndArray(config, utc);
        } else {
            date = makeDateFromStringAndFormat(config);
            removeParsedTokens(config);
            format = "YYYY-MM-DD-" + config._f;
            input = leftZeroFill(date[0], 4) + "-"
                + leftZeroFill(date[1] + 1, 2) + "-"
                + leftZeroFill(date[2], 2) + "-"
                + config._i;
        }
    }
    if (utc){
        m = moment.utc(input, format, lang, strict);
    }
    else{
        m = moment(input, format, lang, strict);
    }
    if (config._isValid === false || (input && input._isAMomentObject && !input._isValid)){
        m._isValid = false;
    }
    m._jDiff = config._jDiff || 0;
    jm = objectCreate(jMoment.fn);
    extend(jm, m);
    if (strict && jm.isValid()) {
        jm._isValid = jm.format(origFormat) === origInput;
    }
    if (input && input.calSystem) {
        jm.calSystem = input.calSystem;
    }
    return jm;
}
1358343
void formatLocalWeekdayStandalone(StringBuilder b, ZonedDateTime d, int width, FieldVariants weekdays, int firstDay) {
    if (width > 2) {
      formatWeekday(b, d, width, weekdays);
      return;
    }
    formatWeekdayNumeric(b, d, firstDay);
  }
354464
function(match, shortNames, longNames, step) {
				var names = (doubled(match, step) ? longNames : shortNames);
				for (var i = 0; i < names.length; i++) {
					if (value.substr(iValue, names[i].length).toLowerCase() === names[i].toLowerCase()) {
						iValue += names[i].length;
						return i + calendar.minMonth;
					}
				}
				throw ($.calendars.local.unknownNameAt || $.calendars.regionalOptions[''].unknownNameAt).
					replace(/\{0\}/, iValue);
			}
401515
function formatDate(d, fmt, monthNames, dayNames) {

		if (typeof d.strftime == "function") {
			return d.strftime(fmt);
		}

		var leftPad = function(n, pad) {
			n = "" + n;
			pad = "" + (pad == null ? "0" : pad);
			return n.length == 1 ? pad + n : n;
		};

		var r = [];
		var escape = false;
		var hours = d.getHours();
		var isAM = hours < 12;

		if (monthNames == null) {
			monthNames = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"];
		}

		if (dayNames == null) {
			dayNames = ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"];
		}

		var hours12;

		if (hours > 12) {
			hours12 = hours - 12;
		} else if (hours == 0) {
			hours12 = 12;
		} else {
			hours12 = hours;
		}

		for (var i = 0; i < fmt.length; ++i) {

			var c = fmt.charAt(i);

			if (escape) {
				switch (c) {
					case 'a': c = "" + dayNames[d.getDay()]; break;
					case 'b': c = "" + monthNames[d.getMonth()]; break;
					case 'd': c = leftPad(d.getDate()); break;
					case 'e': c = leftPad(d.getDate(), " "); break;
					case 'h':	// For back-compat with 0.7; remove in 1.0
					case 'H': c = leftPad(hours); break;
					case 'I': c = leftPad(hours12); break;
					case 'l': c = leftPad(hours12, " "); break;
					case 'm': c = leftPad(d.getMonth() + 1); break;
					case 'M': c = leftPad(d.getMinutes()); break;
					// quarters not in Open Group's strftime specification
					case 'q':
						c = "" + (Math.floor(d.getMonth() / 3) + 1); break;
					case 'S': c = leftPad(d.getSeconds()); break;
					case 'y': c = leftPad(d.getFullYear() % 100); break;
					case 'Y': c = "" + d.getFullYear(); break;
					case 'p': c = (isAM) ? ("" + "am") : ("" + "pm"); break;
					case 'P': c = (isAM) ? ("" + "AM") : ("" + "PM"); break;
					case 'w': c = "" + d.getDay(); break;
				}
				r.push(c);
				escape = false;
			} else {
				if (c == "%") {
					escape = true;
				} else {
					r.push(c);
				}
			}
		}

		return r.join("");
	}
1121156
public static void setCalendarData(Calendar calendar, Locale locale)
    {
        int[] array = (int[])localeData.get(locale);
        if(array == null)
        {
            Calendar c = Calendar.getInstance(locale);
            array = new int[2];
            array[0] = c.getFirstDayOfWeek();
            array[1] = c.getMinimalDaysInFirstWeek();
            localeData.putIfAbsent(locale, array);
        }
        calendar.setFirstDayOfWeek(array[0]);
        calendar.setMinimalDaysInFirstWeek(array[1]);
    }
212837
function getTranslation(m, dst) {
  dst = dst || v3.create();
  dst[0] = m[12];
  dst[1] = m[13];
  dst[2] = m[14];
  return dst;
}
803018
function cronToText(cronspec, sixth, locale = LOCALE) {
  var schedule = parseCron(cronspec, sixth);

  function absFloor(number) {
    if (number < 0) {
      return Math.ceil(number);
    } else {
      return Math.floor(number);
    }
  }

  function toInt(argumentForCoercion) {
    var coercedNumber = +argumentForCoercion,
      value = 0;

    if (coercedNumber !== 0 && isFinite(coercedNumber)) {
      value = absFloor(coercedNumber);
    }

    return value;
  }

  function ordinal(number) {
    var b = number % 10,
      output = (toInt(number % 100 / 10) === 1) ? locale.ORDINALS.th :
        (b === 1) ? locale.ORDINALS.st :
          (b === 2) ? locale.ORDINALS.nd :
            (b === 3) ? locale.ORDINALS.rd : locale.ORDINALS.th;
    return number + output;
  }

  /**
   * For an array of numbers, e.g. a list of hours in a schedule,
   * return a string listing out all of the values (complete with
   * "and" plus ordinal text on the last item).
   * @param {Number[]} numbers
   * @returns {string}
   */
  function numberList(numbers) {
    if (numbers.length < 2) {
      return ordinal(numbers);
    }

    var lastVal = numbers.pop();
    return numbers.join(', ') + ` ${locale['and']} ` + ordinal(lastVal);
  }

  /**
   * Parse a number into day of week, or a month name;
   * used in dateList below.
   * @param {Number|String} value
   * @param {String} type
   * @returns {String}
   */
  function numberToDateName(value, type) {
    if (type == 'dow') {
      return locale.DOW[value - 1];
    } else if (type == 'mon') {
      return locale.MONTH[value - 1];
    }
  }

  /**
   * From an array of numbers corresponding to dates (given in type: either
   * days of the week, or months), return a string listing all the values.
   * @param {Number[]} numbers
   * @param {String} type
   * @returns {String}
   */
  function dateList(numbers, type) {
    if (numbers.length < 2) {
      return numberToDateName('' + numbers[0], type);
    }

    var lastVal = '' + numbers.pop();
    var outputText = '';

    for (var i = 0, value; value = numbers[i]; i++) {
      if (outputText.length > 0) {
        outputText += ', ';
      }
      outputText += numberToDateName(value, type);
    }
    return outputText + ` ${locale['and']} ` + numberToDateName(lastVal, type);
  }

  /**
   * Pad to equivalent of sprintf('%02d').
   * @param {Number} x
   * @returns {string}
   */
  function zeroPad(x) {
    return (x < 10) ? '0' + x : x;
  }

  //----------------

  /**
   * Given a schedule, generate a friendly sentence description.
   * @param {Object} schedule
   * @returns {string}
   */
  function scheduleToSentence(schedule) {
    var outputText = locale.Every + ' ';

    if (schedule['h'] && schedule['m'] && schedule['h'].length <= 2 && schedule['m'].length <= 2) {
      // If there are only one or two specified values for
      // hour or minute, print them in HH:MM format

      var hm = [];
      for (var i = 0; i < schedule['h'].length; i++) {
        for (var j = 0; j < schedule['m'].length; j++) {
          hm.push(zeroPad(schedule['h'][i]) + ':' + zeroPad(schedule['m'][j]));
        }
      }
      if (hm.length < 2) {
        outputText = hm[0];
      } else {
        var lastVal = hm.pop();
        outputText = hm.join(', ') + ` ${locale.and} ` + lastVal;
      }
      if (!schedule['d'] && !schedule['D']) {
        outputText += ` ${locale['every day']}`;
      }
    } else {
      // Otherwise, list out every specified hour/minute value.

      if (schedule['h']) { // runs only at specific hours
        if (schedule['m']) { // and only at specific minutes
          outputText += numberList(schedule['m']) + ` ${locale['minute past the']} ` + numberList(schedule['h']) + ` ${locale['hour']}`;
        } else { // specific hours, but every minute
          outputText += `${locale['minute of']} ` + numberList(schedule['h']) + ` ${locale['hour']}`;
        }
      } else if (schedule['m']) { // every hour, but specific minutes
        outputText += numberList(schedule['m']) + ` ${locale['minute every hour']}`;
      } else { // cronspec has "*" for both hour and minute
        outputText += locale['minute'];
      }
    }

    if (schedule['D']) { // runs only on specific day(s) of month
      outputText += (locale['on the'] ? ` ${locale['on the']} ` : ' ') + numberList(schedule['D']);
      if (!schedule['M']) {
        outputText += ` ${locale['of every month']}`;
      }
    }

    if (schedule['d']) { // runs only on specific day(s) of week
      if (schedule['D']) {
        // if both day fields are specified, cron uses both; superuser.com/a/348372
        outputText += ` ${locale['and every']} `;
      } else {
        outputText += ` ${locale['on']} `;
      }
      outputText += dateList(schedule['d'], 'dow');
    }

    if (schedule['M']) {
      // runs only in specific months; put this output last
      outputText += ` ${locale['in']} ` + dateList(schedule['M'], 'mon');
    }

    return outputText;
  }

  return scheduleToSentence(schedule.schedules[0]);
}
1007896
function dateList(numbers, type) {
    if (numbers.length < 2) {
      return numberToDateName('' + numbers[0], type);
    }

    var lastVal = '' + numbers.pop();
    var outputText = '';

    for (var i = 0, value; value = numbers[i]; i++) {
      if (outputText.length > 0) {
        outputText += ', ';
      }
      outputText += numberToDateName(value, type);
    }
    return outputText + ` ${locale['and']} ` + numberToDateName(lastVal, type);
  }
1127421
private TypeSpec createFormatter(DateTimeData dateTimeData, TimeZoneData timeZoneData, String className) {
    LocaleID id = dateTimeData.id;

    MethodSpec.Builder constructor = MethodSpec.constructorBuilder()
        .addModifiers(PUBLIC);

    constructor.addStatement("this.bundleId = $T.$L", CLDR_LOCALE_IF, id.safe);
    constructor.addStatement("this.firstDay = $L", dateTimeData.firstDay);
    constructor.addStatement("this.minDays = $L", dateTimeData.minDays);

    variantsFieldInit(constructor, "this.eras", dateTimeData.eras);
    variantsFieldInit(constructor, "this.quartersFormat", dateTimeData.quartersFormat);
    variantsFieldInit(constructor, "this.quartersStandalone", dateTimeData.quartersStandalone);
    variantsFieldInit(constructor, "this.monthsFormat", dateTimeData.monthsFormat);
    variantsFieldInit(constructor, "this.monthsStandalone", dateTimeData.monthsStandalone);
    variantsFieldInit(constructor, "this.weekdaysFormat", dateTimeData.weekdaysFormat);
    variantsFieldInit(constructor, "this.weekdaysStandalone", dateTimeData.weekdaysStandalone);
    variantsFieldInit(constructor, "this.dayPeriodsFormat", dateTimeData.dayPeriodsFormat);
    variantsFieldInit(constructor, "this.dayPeriodsStandalone", dateTimeData.dayPeriodsStandalone);

    buildTimeZoneExemplarCities(constructor, timeZoneData);
    buildTimeZoneNames(constructor, timeZoneData);
    buildMetaZoneNames(constructor, timeZoneData);
    
    TypeSpec.Builder type = TypeSpec.classBuilder(className)
        .superclass(CALENDAR_FORMATTER)
        .addModifiers(PUBLIC)
        .addJavadoc(
            "Locale \"" + dateTimeData.id + "\"\n" +
            "See http://www.unicode.org/reports/tr35/tr35-dates.html#Date_Field_Symbol_Table\n")
        .addMethod(constructor.build());

    MethodSpec dateMethod = buildTypedPatternMethod("formatDate", CALENDAR_FORMAT, dateTimeData.dateFormats);
    MethodSpec timeMethod = buildTypedPatternMethod("formatTime", CALENDAR_FORMAT, dateTimeData.timeFormats);
    MethodSpec wrapperMethod = buildWrapperMethod(dateTimeData.dateTimeFormats);
    MethodSpec skeletonMethod = buildSkeletonFormatter(dateTimeData.dateTimeSkeletons);
    MethodSpec intervalMethod = buildIntervalMethod(dateTimeData.intervalFormats, dateTimeData.intervalFallbackFormat);
    MethodSpec gmtMethod = buildWrapTimeZoneGMTMethod(timeZoneData);
    MethodSpec regionFormatMethod = buildWrapTimeZoneRegionMethod(timeZoneData);

    return type
        .addMethod(dateMethod)
        .addMethod(timeMethod)
        .addMethod(wrapperMethod)
        .addMethod(skeletonMethod)
        .addMethod(intervalMethod)
        .addMethod(gmtMethod)
        .addMethod(regionFormatMethod)
        .build();
  }
1343359
def to_jd(year, week, day):
    ''''''
    return day + n_weeks(SUN, gregorian.to_jd(year - 1, 12, 28), week)
446553
private void drawDayNames() {
		int firstDayOfWeek = calendar.getFirstDayOfWeek();
		DateFormatSymbols dateFormatSymbols = new DateFormatSymbols(locale);
		dayNames = dateFormatSymbols.getShortWeekdays();

		int day = firstDayOfWeek;

		for (int i = 0; i < 7; i++) {
			if (maxDayCharacters > 0 && maxDayCharacters < 5) {
				if (dayNames[day].length() >= maxDayCharacters) {
					dayNames[day] = dayNames[day]
							.substring(0, maxDayCharacters);
				}
			}

			days[i].setText(dayNames[day]);

			if (day == 1) {
				days[i].setForeground(sundayForeground);
			} else {
				days[i].setForeground(weekdayForeground);
			}

			if (day < 7) {
				day++;
			} else {
				day -= 6;
			}
		}
	}
469219
def _initLocale(ptc):
    

    def lcase(x):
        return x.lower()

    if pyicu and ptc.usePyICU:
        ptc.icuLocale = None

        if ptc.localeID is not None:
            ptc.icuLocale = pyicu.Locale(ptc.localeID)

        if ptc.icuLocale is None:
            for id in range(0, len(ptc.fallbackLocales)):
                ptc.localeID  = ptc.fallbackLocales[id]
                ptc.icuLocale = pyicu.Locale(ptc.localeID)

                if ptc.icuLocale is not None:
                    break

        ptc.icuSymbols = pyicu.DateFormatSymbols(ptc.icuLocale)

          # grab ICU list of weekdays, skipping first entry which
          # is always blank
        wd  = map(lcase, ptc.icuSymbols.getWeekdays()[1:])
        swd = map(lcase, ptc.icuSymbols.getShortWeekdays()[1:])

          # store them in our list with Monday first (ICU puts Sunday first)
        ptc.Weekdays      = wd[1:] + wd[0:1]
        ptc.shortWeekdays = swd[1:] + swd[0:1]
        ptc.Months        = map(lcase, ptc.icuSymbols.getMonths())
        ptc.shortMonths   = map(lcase, ptc.icuSymbols.getShortMonths())

          # not quite sure how to init this so for now
          # set it to none so it will be set to the en_US defaults for now
        ptc.re_consts   = None
        ptc.icu_df      = { 'full':   pyicu.DateFormat.createDateInstance(pyicu.DateFormat.kFull,   ptc.icuLocale),
                            'long':   pyicu.DateFormat.createDateInstance(pyicu.DateFormat.kLong,   ptc.icuLocale),
                            'medium': pyicu.DateFormat.createDateInstance(pyicu.DateFormat.kMedium, ptc.icuLocale),
                            'short':  pyicu.DateFormat.createDateInstance(pyicu.DateFormat.kShort,  ptc.icuLocale),
                          }
        ptc.icu_tf      = { 'full':   pyicu.DateFormat.createTimeInstance(pyicu.DateFormat.kFull,   ptc.icuLocale),
                            'long':   pyicu.DateFormat.createTimeInstance(pyicu.DateFormat.kLong,   ptc.icuLocale),
                            'medium': pyicu.DateFormat.createTimeInstance(pyicu.DateFormat.kMedium, ptc.icuLocale),
                            'short':  pyicu.DateFormat.createTimeInstance(pyicu.DateFormat.kShort,  ptc.icuLocale),
                          }
        ptc.dateFormats = { 'full':   ptc.icu_df['full'].toPattern(),
                            'long':   ptc.icu_df['long'].toPattern(),
                            'medium': ptc.icu_df['medium'].toPattern(),
                            'short':  ptc.icu_df['short'].toPattern(),
                          }
        ptc.timeFormats = { 'full':   ptc.icu_tf['full'].toPattern(),
                            'long':   ptc.icu_tf['long'].toPattern(),
                            'medium': ptc.icu_tf['medium'].toPattern(),
                            'short':  ptc.icu_tf['short'].toPattern(),
                          }
    else:
        if not ptc.localeID in pdtLocales:
            for id in range(0, len(ptc.fallbackLocales)):
                ptc.localeID  = ptc.fallbackLocales[id]

                if ptc.localeID in pdtLocales:
                    break

        ptc.locale   = pdtLocales[ptc.localeID]
        ptc.usePyICU = False

        ptc.Weekdays      = ptc.locale.Weekdays
        ptc.shortWeekdays = ptc.locale.shortWeekdays
        ptc.Months        = ptc.locale.Months
        ptc.shortMonths   = ptc.locale.shortMonths
        ptc.dateFormats   = ptc.locale.dateFormats
        ptc.timeFormats   = ptc.locale.timeFormats

      # these values are used to setup the various bits 
      # of the regex values used to parse
      #
      # check if a local set of constants has been
      # provided, if not use en_US as the default
    if ptc.localeID in pdtLocales:
        ptc.re_sources = pdtLocales[ptc.localeID].re_sources
        ptc.re_values  = pdtLocales[ptc.localeID].re_consts

        units = pdtLocales[ptc.localeID].units

        ptc.Modifiers  = pdtLocales[ptc.localeID].modifiers
        ptc.dayOffsets = pdtLocales[ptc.localeID].dayoffsets

          # for now, pull over any missing keys from the US set
        for key in pdtLocales['en_US'].re_consts:
            if not key in ptc.re_values:
                ptc.re_values[key] = pdtLocales['en_US'].re_consts[key]
    else:
        ptc.re_sources = pdtLocales['en_US'].re_sources
        ptc.re_values  = pdtLocales['en_US'].re_consts
        ptc.Modifiers  = pdtLocales['en_US'].modifiers
        ptc.dayOffsets = pdtLocales['en_US'].dayoffsets
        units          = pdtLocales['en_US'].units

      # escape any regex special characters that may be found
    wd   = tuple(map(re.escape, ptc.Weekdays))
    swd  = tuple(map(re.escape, ptc.shortWeekdays))
    mth  = tuple(map(re.escape, ptc.Months))
    smth = tuple(map(re.escape, ptc.shortMonths))

    ptc.re_values['months']      = '%s|%s|%s|%s|%s|%s|%s|%s|%s|%s|%s|%s' % mth
    ptc.re_values['shortmonths'] = '%s|%s|%s|%s|%s|%s|%s|%s|%s|%s|%s|%s' % smth
    ptc.re_values['days']        = '%s|%s|%s|%s|%s|%s|%s' % wd
    ptc.re_values['shortdays']   = '%s|%s|%s|%s|%s|%s|%s' % swd

    l = []
    for unit in units:
        l.append('|'.join(units[unit]))

    ptc.re_values['units'] = '|'.join(l)
    ptc.Units              = ptc.re_values['units'].split('|')
61406
function _createElements()
    {
        $this->_separator = $this->_elements = array();
        $separator =  '';
        $locale    =& $this->_locale[$this->_options['language']];
        $backslash =  false;
        for ($i = 0, $length = strlen($this->_options['format']); $i < $length; $i++) {
            $sign = $this->_options['format']{$i};
            if ($backslash) {
                $backslash  = false;
                $separator .= $sign;
            } else {
                $loadSelect = true;
                switch ($sign) {
                    case 'D':
                        // Sunday is 0 like with 'w' in date()
                        $options = $locale['weekdays_short'];
                        break;
                    case 'l':
                        $options = $locale['weekdays_long'];
                        break;
                    case 'd':
                        $options = $this->_createOptionList(1, 31);
                        break;
                    case 'M':
                        $options = $locale['months_short'];
                        array_unshift($options , '');
                        unset($options[0]);
                        break;
                    case 'm':
                        $options = $this->_createOptionList(1, 12);
                        break;
                    case 'F':
                        $options = $locale['months_long'];
                        array_unshift($options , '');
                        unset($options[0]);
                        break;
                    case 'Y':
                        $options = $this->_createOptionList(
                            $this->_options['minYear'],
                            $this->_options['maxYear'],
                            $this->_options['minYear'] > $this->_options['maxYear']? -1: 1
                        );
                        break;
                    case 'y':
                        $options = $this->_createOptionList(
                            $this->_options['minYear'],
                            $this->_options['maxYear'],
                            $this->_options['minYear'] > $this->_options['maxYear']? -1: 1
                        );
                        array_walk($options, function(&$v, $k) {
                            $v = substr($v, -2);
                        });
                        break;
                    case 'h':
                        $options = $this->_createOptionList(1, 12);
                        break;
                    case 'g':
                        $options = $this->_createOptionList(1, 12);
                        array_walk($options, function(&$v, $k) {
                            $v = intval($v);
                        });
                        break;
                    case 'H':
                        $options = $this->_createOptionList(0, 23);
                        break;
                    case 'i':
                        $options = $this->_createOptionList(0, 59, $this->_options['optionIncrement']['i']);
                        break;
                    case 's':
                        $options = $this->_createOptionList(0, 59, $this->_options['optionIncrement']['s']);
                        break;
                    case 'a':
                        $options = array('am' => 'am', 'pm' => 'pm');
                        break;
                    case 'A':
                        $options = array('AM' => 'AM', 'PM' => 'PM');
                        break;
                    case 'W':
                        $options = $this->_createOptionList(1, 53);
                        break;
                    case '\\':
                        $backslash  = true;
                        $loadSelect = false;
                        break;
                    default:
                        $separator .= (' ' == $sign? '&nbsp;': $sign);
                        $loadSelect = false;
                }

                if ($loadSelect) {
                    if (0 < count($this->_elements)) {
                        $this->_separator[] = $separator;
                    } else {
                        $this->_wrap[0] = $separator;
                    }
                    $separator = '';
                    // Should we add an empty option to the top of the select?
                    if (!is_array($this->_options['addEmptyOption']) && $this->_options['addEmptyOption'] ||
                        is_array($this->_options['addEmptyOption']) && !empty($this->_options['addEmptyOption'][$sign])) {

                        // Using '+' array operator to preserve the keys
                        if (is_array($this->_options['emptyOptionText']) && !empty($this->_options['emptyOptionText'][$sign])) {
                            $options = array($this->_options['emptyOptionValue'] => $this->_options['emptyOptionText'][$sign]) + $options;
                        } else {
                            $options = array($this->_options['emptyOptionValue'] => $this->_options['emptyOptionText']) + $options;
                        }
                    }
                    $this->_elements[] = new HTML_QuickForm_select($sign, null, $options, $this->getAttributes());
                }
            }
        }
        $this->_wrap[1] = $separator . ($backslash? '\\': '');
    }
453398
private function setMonthNames() {
		
		if (empty($this->options['locale']['monthNames'])) {
			$this->options['locale']['monthNames'] = array_values(
				Yii::app()->locale->getMonthNames('wide', true)
			);
		}
	}
631881
protected static function _calendartranslation()
	{
		static $jsscript = 0;

		if ($jsscript == 0)
		{
			$return = 'Calendar._DN = new Array ("' . Lang::txt('SUNDAY', true) . '", "' . Lang::txt('MONDAY', true) . '", "'
				. Lang::txt('TUESDAY', true) . '", "' . Lang::txt('WEDNESDAY', true) . '", "' . Lang::txt('THURSDAY', true) . '", "'
				. Lang::txt('FRIDAY', true) . '", "' . Lang::txt('SATURDAY', true) . '", "' . Lang::txt('SUNDAY', true) . '");'
				. ' Calendar._SDN = new Array ("' . Lang::txt('SUN', true) . '", "' . Lang::txt('MON', true) . '", "' . Lang::txt('TUE', true) . '", "'
				. Lang::txt('WED', true) . '", "' . Lang::txt('THU', true) . '", "' . Lang::txt('FRI', true) . '", "' . Lang::txt('SAT', true) . '", "'
				. Lang::txt('SUN', true) . '");' . ' Calendar._FD = 0;' . ' Calendar._MN = new Array ("' . Lang::txt('JANUARY', true) . '", "'
				. Lang::txt('FEBRUARY', true) . '", "' . Lang::txt('MARCH', true) . '", "' . Lang::txt('APRIL', true) . '", "' . Lang::txt('MAY', true)
				. '", "' . Lang::txt('JUNE', true) . '", "' . Lang::txt('JULY', true) . '", "' . Lang::txt('AUGUST', true) . '", "'
				. Lang::txt('SEPTEMBER', true) . '", "' . Lang::txt('OCTOBER', true) . '", "' . Lang::txt('NOVEMBER', true) . '", "'
				. Lang::txt('DECEMBER', true) . '");' . ' Calendar._SMN = new Array ("' . Lang::txt('JANUARY_SHORT', true) . '", "'
				. Lang::txt('FEBRUARY_SHORT', true) . '", "' . Lang::txt('MARCH_SHORT', true) . '", "' . Lang::txt('APRIL_SHORT', true) . '", "'
				. Lang::txt('MAY_SHORT', true) . '", "' . Lang::txt('JUNE_SHORT', true) . '", "' . Lang::txt('JULY_SHORT', true) . '", "'
				. Lang::txt('AUGUST_SHORT', true) . '", "' . Lang::txt('SEPTEMBER_SHORT', true) . '", "' . Lang::txt('OCTOBER_SHORT', true) . '", "'
				. Lang::txt('NOVEMBER_SHORT', true) . '", "' . Lang::txt('DECEMBER_SHORT', true) . '");'
				. ' Calendar._TT = {};Calendar._TT["INFO"] = "' . Lang::txt('JLIB_HTML_BEHAVIOR_ABOUT_THE_CALENDAR', true) . '";'
				. ' Calendar._TT["ABOUT"] =
 "DHTML Date/Time Selector\n" +
 "(c) dynarch.com 2002-2005 / Author: Mihai Bazon\n" +
"For latest version visit: http://www.dynarch.com/projects/calendar/\n" +
"Distributed under GNU LGPL.  See http://gnu.org/licenses/lgpl.html for details." +
"\n\n" +
"' . Lang::txt('JLIB_HTML_BEHAVIOR_DATE_SELECTION', false, false) . '" +
"' . Lang::txt('JLIB_HTML_BEHAVIOR_YEAR_SELECT', false, false) . '" +
"' . Lang::txt('JLIB_HTML_BEHAVIOR_MONTH_SELECT', false, false) . '" +
"' . Lang::txt('JLIB_HTML_BEHAVIOR_HOLD_MOUSE', false, false)
				. '";
Calendar._TT["ABOUT_TIME"] = "\n\n" +
"Time selection:\n" +
"- Click on any of the time parts to increase it\n" +
"- or Shift-click to decrease it\n" +
"- or click and drag for faster selection.";

		Calendar._TT["PREV_YEAR"] = "' . Lang::txt('JLIB_HTML_BEHAVIOR_PREV_YEAR_HOLD_FOR_MENU', true) . '";' . ' Calendar._TT["PREV_MONTH"] = "'
				. Lang::txt('JLIB_HTML_BEHAVIOR_PREV_MONTH_HOLD_FOR_MENU', true) . '";' . ' Calendar._TT["GO_TODAY"] = "'
				. Lang::txt('JLIB_HTML_BEHAVIOR_GO_TODAY', true) . '";' . ' Calendar._TT["NEXT_MONTH"] = "'
				. Lang::txt('JLIB_HTML_BEHAVIOR_NEXT_MONTH_HOLD_FOR_MENU', true) . '";' . ' Calendar._TT["NEXT_YEAR"] = "'
				. Lang::txt('JLIB_HTML_BEHAVIOR_NEXT_YEAR_HOLD_FOR_MENU', true) . '";' . ' Calendar._TT["SEL_DATE"] = "'
				. Lang::txt('JLIB_HTML_BEHAVIOR_SELECT_DATE', true) . '";' . ' Calendar._TT["DRAG_TO_MOVE"] = "'
				. Lang::txt('JLIB_HTML_BEHAVIOR_DRAG_TO_MOVE', true) . '";' . ' Calendar._TT["PART_TODAY"] = "'
				. Lang::txt('JLIB_HTML_BEHAVIOR_TODAY', true) . '";' . ' Calendar._TT["DAY_FIRST"] = "'
				. Lang::txt('JLIB_HTML_BEHAVIOR_DISPLAY_S_FIRST', true) . '";' . ' Calendar._TT["WEEKEND"] = "0,6";' . ' Calendar._TT["CLOSE"] = "'
				. Lang::txt('JLIB_HTML_BEHAVIOR_CLOSE', true) . '";' . ' Calendar._TT["TODAY"] = "' . Lang::txt('JLIB_HTML_BEHAVIOR_TODAY', true)
				. '";' . ' Calendar._TT["TIME_PART"] = "' . Lang::txt('JLIB_HTML_BEHAVIOR_SHIFT_CLICK_OR_DRAG_TO_CHANGE_VALUE', true) . '";'
				. ' Calendar._TT["DEF_DATE_FORMAT"] = "%Y-%m-%d";' . ' Calendar._TT["TT_DATE_FORMAT"] = "'
				. Lang::txt('JLIB_HTML_BEHAVIOR_TT_DATE_FORMAT', true) . '";' . ' Calendar._TT["WK"] = "' . Lang::txt('JLIB_HTML_BEHAVIOR_WK', true) . '";'
				. ' Calendar._TT["TIME"] = "' . Lang::txt('JLIB_HTML_BEHAVIOR_TIME', true) . '";';
			$jsscript = 1;
			return $return;
		}
		else
		{
			return false;
		}
	}
1372011
function createUnits(conversions, withNames=false) {
    const result = {};
    conversions.forEach(c => c.names.forEach(name =>
        result[unitToLower(normalizeUnitName(name))] = {
            name: c.names[0],

            prefix: c.prefix,

            scale: c.scale,
            toBase: c.toBase,
            fromBase: c.fromBase,

            names: withNames ? c.names : null
        }
    ));
    return result;
}