#NEWLINE# def avail( locale ) : #NEWLINE# #INDENT# "\n    Check if a locale is available.\n\n    .. versionadded:: 2014.7.0\n\n    CLI Example:\n\n    .. code-block:: bash\n\n        salt '*' locale.avail 'en_US.UTF-8'\n    " #NEWLINE# try : #NEWLINE# #INDENT# normalized_locale = salt . utils . locales . normalize_locale ( normalized_locale ) #NEWLINE# #UNINDENT# except IndexError : #NEWLINE# #INDENT# log . error ( 'Unable to validate locale "{0}"' . format ( locale ) ) #NEWLINE# return False #NEWLINE# #UNINDENT# avail_locales = __salt__ [ 'locale.list_avail' ] ( ) #NEWLINE# locale_exists = next ( ( True for x in avail_locales if ( salt . utils . locales . normalize_locale ( x . strip ( ) ) == normalized_locale ) ) , False ) #NEWLINE# return locale_exists