Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 482034 | Differences between
and this patch

Collapse All | Expand All

(-)trac/util/translation.py (-4 / +8 lines)
Lines 330-345 Link Here
330
    def get_translations():
330
    def get_translations():
331
        return translations
331
        return translations
332
332
333
    def get_available_locales():
333
    def get_available_locales(check_catalog=True):
334
        """Return a list of locale identifiers of the locales for which
334
        """Return a list of locale identifiers of the locales for which
335
        translations are available.
335
        translations are available.
336
337
        :param check_catalog: if `True` check for the compiled catalog
338
                              (.mo), otherwise the presence of the
339
                              directory is enough.
336
        """
340
        """
337
        try:
341
        try:
338
            return [dirname for dirname
342
            return [dirname for dirname
339
                    in pkg_resources.resource_listdir('trac', 'locale')
343
                    in pkg_resources.resource_listdir('trac', 'locale')
340
                    if '.' not in dirname
344
                    if '.' not in dirname
341
                    and pkg_resources.resource_exists(
345
                    and (not check_catalog or pkg_resources.resource_exists(
342
                    'trac', 'locale/%s/LC_MESSAGES/messages.mo' % dirname)]
346
                        'trac', 'locale/%s/LC_MESSAGES/messages.mo' % dirname))]
343
        except Exception:
347
        except Exception:
344
            return []
348
            return []
345
349
Lines 378-384 Link Here
378
    def get_translations():
382
    def get_translations():
379
        return translations
383
        return translations
380
384
381
    def get_available_locales():
385
    def get_available_locales(check_catalog=True):
382
        return []
386
        return []
383
387
384
    def get_negotiated_locale(preferred=None, default=None):
388
    def get_negotiated_locale(preferred=None, default=None):
(-)trac/util/datefmt.py (-3 / +2 lines)
Lines 534-541 Link Here
534
        'period_names': period_names,
534
        'period_names': period_names,
535
    }
535
    }
536
536
537
_I18N_PARSE_DATE_PATTERNS = dict(map(lambda l: (l, False),
537
_I18N_PARSE_DATE_PATTERNS = dict(
538
                                     get_available_locales()))
538
    (l, False) for l in get_available_locales(check_catalog=False))
539
539
540
def _i18n_parse_date(text, tzinfo, locale):
540
def _i18n_parse_date(text, tzinfo, locale):
541
    locale = Locale.parse(locale)
541
    locale = Locale.parse(locale)
542
-----------------------------------------------------------------------

Return to bug 482034