public static Map < String , String > loadResourceBundle ( String bundleName , Encoding encoding , String newline , Locale locale ) throws IOException , SyntaxErrorException , MissingResourceException { String _baseName = bundleName . replace ( "." , "/" ) ; List < URL > _bundle = new ArrayList < URL > ( 3 ) ; URL _resource = FileTools . class . getClassLoader ( ) . getResource ( _baseName + FILE_EXTENSION__PROPERTIES ) ; if ( null != _resource ) { _bundle . add ( _resource ) ; } if ( null != locale && IS_NOT_EMPTY . test ( locale . getLanguage ( ) ) ) { _resource = FileTools . class . getClassLoader ( ) . getResource ( _baseName + "_" + locale . getLanguage ( ) + FILE_EXTENSION__PROPERTIES ) ; if ( null != _resource ) { _bundle . add ( _resource ) ; } if ( IS_NOT_EMPTY . test ( locale . getCountry ( ) ) ) { _resource = FileTools . class . getClassLoader ( ) . getResource ( _baseName + "_" + locale . getLanguage ( ) + "_" + locale . getCountry ( ) + FILE_EXTENSION__PROPERTIES ) ; if ( null != _resource ) { _bundle . add ( _resource ) ; } } } if ( _bundle . isEmpty ( ) ) { throw new MissingResourceException ( bundleName , null , null ) ; } return loadBundle ( _bundle , encoding , newline ) ; }
Load a properties file looking for localized versions like ResourceBundle supporting multiple line values .