private Map < String , Properties > loadRegisteredMessageResources ( ) { Map < String , Properties > internalMessages = loadRegisteredMessageResources ( "pippo/pippo-messages%s.properties" ) ; Map < String , Properties > applicationMessages = loadRegisteredMessageResources ( "conf/messages%s.properties" ) ; Map < String , Properties > allMessages = new TreeMap <> ( ) ; Set < String > merged = new HashSet <> ( ) ; // create aggregate messages for ( Map . Entry < String , Properties > entry : internalMessages . entrySet ( ) ) { String language = entry . getKey ( ) ; Properties messages = entry . getValue ( ) ; allMessages . put ( language , messages ) ; if ( applicationMessages . containsKey ( language ) ) { // override internal messages with application messages messages . putAll ( applicationMessages . get ( language ) ) ; } merged . add ( language ) ; } // bring in the application languages which do not have an internal counterpart Set < String > unmerged = new HashSet <> ( applicationMessages . keySet ( ) ) ; unmerged . removeAll ( merged ) ; for ( String language : unmerged ) { allMessages . put ( language , applicationMessages . get ( language ) ) ; } return allMessages ; }
Loads Pippo internal messages & application messages and returns the merger .