How to use the parsedatetime.pdt_locales.pdtLocale_base function in parsedatetime

To help you get started, we’ve selected a few parsedatetime examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github MuppetGate / Alfred-Workflows-DateCalculator / parsedatetime / pdt_locales.py View on Github external
else:
                ds = '/'

            self.dateSep = [ ds ]
            s            = self.dateFormats['short']
            l            = s.lower().split(ds)
            dp_order     = []

            for s in l:
               if len(s) > 0:
                   dp_order.append(s[:1])

            self.dp_order = dp_order


class pdtLocale_en(pdtLocale_base):
    """
    en_US Locale
    """
    def __init__(self):
        super( pdtLocale_en, self ).__init__()

        self.localeID = 'en_US'  # don't use a unicode string
        self.uses24   = False


class pdtLocale_au(pdtLocale_base):
    """
    en_AU Locale
    """
    def __init__(self):
        super( pdtLocale_au, self ).__init__()
github MuppetGate / Alfred-Workflows-DateCalculator / parsedatetime / pdt_locales.py View on Github external
self.localeID = 'en_A'   # don't use a unicode string
        self.dateSep  = [ '-', '/' ]
        self.uses24   = False

        self.dateFormats['full']   = 'EEEE, d MMMM yyyy'
        self.dateFormats['long']   = 'd MMMM yyyy'
        self.dateFormats['medium'] = 'dd/MM/yyyy'
        self.dateFormats['short']  = 'd/MM/yy'

        self.timeFormats['long']   = self.timeFormats['full']

        self.dp_order = [ 'd', 'm', 'y' ]


class pdtLocale_es(pdtLocale_base):
    """
    es Locale

    Note that I don't speak Spanish so many of the items below are still in English
    """
    def __init__(self):
        super( pdtLocale_es, self ).__init__()

        self.localeID     = 'es'   # don't use a unicode string
        self.dateSep      = [ '/' ]
        self.usesMeridian = False
        self.uses24       = True

        self.Weekdays      = [ 'lunes', 'martes', 'mi\xe9rcoles',
                               'jueves', 'viernes', 's\xe1bado', 'domingo',
                             ]
github bear / parsedatetime / parsedatetime / pdt_locales.py View on Github external
self.re_sources['mittags']         = { 'hr': 12, 'mn': 0, 'sec': 0 }
        self.re_sources['mittagessen']     = { 'hr': 12, 'mn': 0, 'sec': 0 }
        self.re_sources['morgen']          = { 'hr':  6, 'mn': 0, 'sec': 0 }
        self.re_sources['morgens']         = { 'hr':  6, 'mn': 0, 'sec': 0 }
        self.re_sources[r'fr\e4hst\xe4ck'] = { 'hr':  8, 'mn': 0, 'sec': 0 }
        self.re_sources['abendessen']      = { 'hr': 19, 'mn': 0, 'sec': 0 }
        self.re_sources['abend']           = { 'hr': 18, 'mn': 0, 'sec': 0 }
        self.re_sources['abends']          = { 'hr': 18, 'mn': 0, 'sec': 0 }
        self.re_sources['mitternacht']     = { 'hr':  0, 'mn': 0, 'sec': 0 }
        self.re_sources['nacht']           = { 'hr': 21, 'mn': 0, 'sec': 0 }
        self.re_sources['nachts']          = { 'hr': 21, 'mn': 0, 'sec': 0 }
        self.re_sources['heute abend']     = { 'hr': 21, 'mn': 0, 'sec': 0 }
        self.re_sources['heute nacht']     = { 'hr': 21, 'mn': 0, 'sec': 0 }
        self.re_sources['feierabend']      = { 'hr': 17, 'mn': 0, 'sec': 0 }

class pdtLocale_nl(pdtLocale_base):
    """
    nl_NL Locale constants

    Contributed by Dirkjan Krijnders 
    """
    def __init__(self):
        super( pdtLocale_nl, self ).__init__()

        self.localeID      = 'nl_NL'   # don't use a unicode string
        self.dateSep       = [ '-' , '/']
        self.timeSep       = [ ':' ]
        self.meridian      = [ ]
        self.usesMeridian  = False
        self.uses24        = True
        self.decimal_mark = ','
github bear / parsedatetime / parsedatetime / pdt_locales.py View on Github external
self.dateFormats['short']  = "dd/MM/yyyy"

        self.timeFormats['full']   = "HH'H'mm' 'ss z"
        self.timeFormats['long']   = "HH:mm:ss z"
        self.timeFormats['medium'] = "HH:mm:ss"
        self.timeFormats['short']  = "HH:mm"

        self.dp_order = [ 'd', 'm', 'y' ]

        self.units['seconds'] = [ 'segundo', 'seg', 's']
        self.units['minutes'] = [ 'minuto', 'min',  'm']
        self.units['days']    = [ 'dia',  'dias',   'd']
        self.units['months']  = [ 'm\xeas',     'meses']


class pdtLocale_de(pdtLocale_base):
    """
    de_DE Locale constants

    Contributed by Debian parsedatetime package maintainer Bernd Zeimetz 
    """
    def __init__(self):
        super( pdtLocale_de, self ).__init__()

        self.localeID      = 'de_DE'   # don't use a unicode string
        self.dateSep       = [ '.' ]
        self.timeSep       = [ ':' ]
        self.meridian      = [ ]
        self.usesMeridian  = False
        self.uses24        = True
        self.decimal_mark = ','
github MuppetGate / Alfred-Workflows-DateCalculator / parsedatetime / pdt_locales.py View on Github external
self.dateFormats['short']  = "dd/MM/yyyy"

        self.timeFormats['full']   = "HH'H'mm' 'ss z"
        self.timeFormats['long']   = "HH:mm:ss z"
        self.timeFormats['medium'] = "HH:mm:ss"
        self.timeFormats['short']  = "HH:mm"

        self.dp_order = [ 'd', 'm', 'y' ]

        self.units['seconds'] = [ 'segundo', 'seg', 's']
        self.units['minutes'] = [ 'minuto', 'min',  'm']
        self.units['days']    = [ 'dia',  'dias',   'd']
        self.units['months']  = [ 'm\xeas',     'meses']


class pdtLocale_de(pdtLocale_base):
    """
    de_DE Locale constants

    Contributed by Debian parsedatetime package maintainer Bernd Zeimetz 
    """
    def __init__(self):
        super( pdtLocale_de, self ).__init__()

        self.localeID      = 'de_DE'   # don't use a unicode string
        self.dateSep       = [ '.' ]
        self.timeSep       = [ ':' ]
        self.meridian      = [ ]
        self.usesMeridian  = False
        self.uses24        = True

        self.Weekdays      = [ 'montag', 'dienstag', 'mittwoch',
github kvh / parsedatetime / parsedatetime / pdt_locales.py View on Github external
# to fill in any value to be replace - the current date/time will
          # already have been populated by the method buildSources
        self.re_sources    = { 'noon':      { 'hr': 12, 'mn': 0, 'sec': 0 },
                               'lunch':     { 'hr': 12, 'mn': 0, 'sec': 0 },
                               'morning':   { 'hr':  6, 'mn': 0, 'sec': 0 },
                               'breakfast': { 'hr':  8, 'mn': 0, 'sec': 0 },
                               'dinner':    { 'hr': 19, 'mn': 0, 'sec': 0 },
                               'evening':   { 'hr': 18, 'mn': 0, 'sec': 0 },
                               'midnight':  { 'hr':  0, 'mn': 0, 'sec': 0 },
                               'night':     { 'hr': 21, 'mn': 0, 'sec': 0 },
                               'tonight':   { 'hr': 21, 'mn': 0, 'sec': 0 },
                               'eod':       { 'hr': 17, 'mn': 0, 'sec': 0 },
                             }


class pdtLocale_icu(pdtLocale_base):
    """
    Create a locale from pyICU
    """
    def __init__(self, localeID):
        super( pdtLocale_icu, self ).__init__()

        self.icu = None

        if pyicu is not None:
            self.icu = pyicu.Locale(localeID)

        if self.icu is not None:
            self.symbols = pyicu.DateFormatSymbols(self.icu)

              # grab ICU list of weekdays, skipping first entry which
              # is always blank
github kvh / parsedatetime / parsedatetime / pdt_locales.py View on Github external
'oct', 'nov', 'dic'
                             ]
        self.dateFormats['full']   = "EEEE d' de 'MMMM' de 'yyyy"
        self.dateFormats['long']   = "d' de 'MMMM' de 'yyyy"
        self.dateFormats['medium'] = "dd-MMM-yy"
        self.dateFormats['short']  = "d/MM/yy"

        self.timeFormats['full']   = "HH'H'mm' 'ss z"
        self.timeFormats['long']   = "HH:mm:ss z"
        self.timeFormats['medium'] = "HH:mm:ss"
        self.timeFormats['short']  = "HH:mm"

        self.dp_order = [ 'd', 'm', 'y' ]


class pdtLocale_de(pdtLocale_base):
    """
    de_DE Locale constants

    Contributed by Debian parsedatetime package maintainer Bernd Zeimetz 
    """
    def __init__(self):
        super( pdtLocale_de, self ).__init__()

        self.localeID      = 'de_DE'   # don't use a unicode string
        self.dateSep       = [ '.' ]
        self.timeSep       = [ ':' ]
        self.meridian      = [ ]
        self.usesMeridian  = False
        self.uses24        = True

        self.Weekdays      = [ 'montag', 'dienstag', 'mittwoch',
github bear / parsedatetime / parsedatetime / pdt_locales.py View on Github external
'million':     1000000,
                          'billion':     1000000000,
                          'trillion':    1000000000000,
                          'quadrillion': 1000000000000000,
                          'quintillion': 1000000000000000000,
                          'sextillion':  1000000000000000000000,
                          'septillion':  1000000000000000000000000,
                          'octillion':   1000000000000000000000000000,
                          'nonillion':   1000000000000000000000000000000,
                          'decillion':   1000000000000000000000000000000000,
                          }

        self.ignore = ('and', ',')


class pdtLocale_icu(pdtLocale_base):
    """
    Create a locale from pyICU
    """
    def __init__(self, localeID):
        super( pdtLocale_icu, self ).__init__()

        self.icu = None

        if pyicu is not None:
            if localeID is None:
              localeID = 'en_US'
            self.icu = pyicu.Locale(localeID)

        if self.icu is not None:
            # grab spelled out format of all numbers from 0 to 100
            rbnf = pyicu.RuleBasedNumberFormat(pyicu.URBNFRuleSetTag.SPELLOUT, self.icu)
github MuppetGate / Alfred-Workflows-DateCalculator / parsedatetime / pdt_locales.py View on Github external
'oct', 'nov', 'dic'
                             ]
        self.dateFormats['full']   = "EEEE d' de 'MMMM' de 'yyyy"
        self.dateFormats['long']   = "d' de 'MMMM' de 'yyyy"
        self.dateFormats['medium'] = "dd-MMM-yy"
        self.dateFormats['short']  = "d/MM/yy"

        self.timeFormats['full']   = "HH'H'mm' 'ss z"
        self.timeFormats['long']   = "HH:mm:ss z"
        self.timeFormats['medium'] = "HH:mm:ss"
        self.timeFormats['short']  = "HH:mm"

        self.dp_order = [ 'd', 'm', 'y' ]


class pdtLocale_ptBR(pdtLocale_base):
    """
    pt_BR Locale

    """
    def __init__(self):
        super( pdtLocale_ptBR, self ).__init__()

        self.localeID     = 'pt_BR'   # don't use a unicode string
        self.dateSep      = [ '/' ]
        self.usesMeridian = False
        self.uses24       = True

        self.Weekdays      = [ 'segunda-feira', 'ter\xe7a-feira', 'quarta-feira',
                               'quinta-feira', 'sexta-feira', 's\xe1bado', 'domingo',
                             ]
        self.shortWeekdays = [ 'seg', 'ter', 'qua',
github MuppetGate / Alfred-Workflows-DateCalculator / parsedatetime / pdt_locales.py View on Github external
'million':     1000000,
                          'billion':     1000000000,
                          'trillion':    1000000000000,
                          'quadrillion': 1000000000000000,
                          'quintillion': 1000000000000000000,
                          'sextillion':  1000000000000000000000,
                          'septillion':  1000000000000000000000000,
                          'octillion':   1000000000000000000000000000,
                          'nonillion':   1000000000000000000000000000000,
                          'decillion':   1000000000000000000000000000000000,
                          }

        self.ignore = ('and', ',')


class pdtLocale_icu(pdtLocale_base):
    """
    Create a locale from pyICU
    """
    def __init__(self, localeID):
        super( pdtLocale_icu, self ).__init__()

        self.icu = None

        if pyicu is not None:
            if localeID is None:
              localeID = 'en_US'
            self.icu = pyicu.Locale(localeID)

        if self.icu is not None:
            # grab spelled out format of all numbers from 0 to 100
            rbnf = pyicu.RuleBasedNumberFormat(pyicu.URBNFRuleSetTag.SPELLOUT, self.icu)