public Properties getAllMessages ( Locale locale ) { Properties props = new Properties ( ) ; Properties mergedProps = null ; if ( locale == null ) { locale = Locale . getDefault ( ) ; } mergedProps = getMergedProperties ( locale ) . getProperties ( ) ; Set < Entry < Object , Object > > entries = mergedProps . entrySet ( ) ; for ( Entry < Object , Object > entry : entries ) { String key = ( String ) entry . getKey ( ) ; if ( LocaleUtils . matchesFilter ( key , filters ) ) { try { // Use the property encoding of the file String msg = getMessage ( key , new Object [ 0 ] , locale ) ; // When war is deployed, the resource bundle are encoded in ISO 8859-1 // and otherwise in UTF-8 // Check the following link for more detail https://grails.org/Internationalization if ( ! warDeployed ) { msg = new String ( msg . getBytes ( CHARSET_ISO_8859_1 ) , CHARSET_UTF_8 ) ; } props . put ( key , msg ) ; } catch ( NoSuchMessageException e ) { // This is expected, so it's OK to have an empty catch // block. if ( LOGGER . isDebugEnabled ( ) ) LOGGER . debug ( "Message key [" + key + "] not found." ) ; } catch ( UnsupportedEncodingException e ) { LOGGER . warn ( "Unable to convert value of message bundle associated to key '" + key + "' because the charset is unknown" ) ; } } } return props ; }
Returns all the messages