Helper function to initialize the different lists and strings
    from either PyICU or one of the internal pdt Locales and store
    them into ptc.

def _initLocale(ptc):
    """
    Helper function to initialize the different lists and strings
    from either PyICU or one of the internal pdt Locales and store
    them into 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('|')