#NEWLINE# def get_available_languages( domain ) : #NEWLINE# #INDENT# 'Lists the available languages for the given translation domain.\n\n    :param domain: the domain to get languages for\n    ' #NEWLINE# if ( domain in _AVAILABLE_LANGUAGES ) : #NEWLINE# #INDENT# return copy . copy ( _AVAILABLE_LANGUAGES [ domain ] ) #NEWLINE# #UNINDENT# localedir = ( '%s_LOCALEDIR' % domain . upper ( ) ) #NEWLINE# find = ( lambda x : gettext . find ( domain , localedir = os . environ . get ( localedir ) , languages = [ x ] ) ) #NEWLINE# language_list = [ 'en_US' ] #NEWLINE# list_identifiers = ( getattr ( localedata , 'list' , None ) or getattr ( localedata , 'locale_identifiers' ) ) #NEWLINE# locale_identifiers = list_identifiers ( ) #NEWLINE# for i in locale_identifiers : #NEWLINE# #INDENT# if ( find ( i ) is not None ) : #NEWLINE# #INDENT# language_list . append ( i ) #NEWLINE# #UNINDENT# #UNINDENT# aliases = { #NEWLINE# #INDENT# 'zh' : 'zh_CN' , #NEWLINE# 'zh_Hant_HK' : 'zh_HK' , #NEWLINE# 'zh_Hant' : 'zh_TW' , #NEWLINE# 'fil' : 'tl_PH' , #NEWLINE# #UNINDENT# } #NEWLINE# for ( locale_ , alias ) in six . iteritems ( aliases ) : #NEWLINE# #INDENT# if ( ( locale_ in language_list ) and ( alias not in language_list ) ) : #NEWLINE# #INDENT# language_list . append ( alias ) #NEWLINE# #UNINDENT# #UNINDENT# _AVAILABLE_LANGUAGES [ domain ] = language_list #NEWLINE# return copy . copy ( language_list )