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): |