private static String getLocalizedOrCode ( String bundleName , Locale locale , String code , String [ ] values ) { ResourceBundle bundle = null ; if ( bundleName != null ) { bundle = ResourceBundle . getBundle ( bundleName , locale ) ; } if ( bundle == null ) { return code ; } String locMessage = bundle . getString ( code ) ; if ( locMessage == null ) { return code ; } if ( values == null ) { return locMessage ; } return MessageFormat . format ( locMessage , ( Object [ ] ) values ) ; }
Gets the message from the resource bundle formatting it if needed and on failure just returns the code .