private String translate ( String lang , String value ) { String translatation = null ; if ( value != null ) { if ( ! bundleMap . containsKey ( lang ) ) { Locale locale = new Locale ( lang ) ; try { ResourceBundle loadedBundle = ResourceBundle . getBundle ( bundleName , locale , ResourceBundle . Control . getNoFallbackControl ( ResourceBundle . Control . FORMAT_DEFAULT ) ) ; bundleMap . put ( lang , loadedBundle ) ; } catch ( MissingResourceException e ) { return null ; } } try { // can we received more than one path section? e.g./search/service/ translatation = bundleMap . get ( lang ) . getString ( value ) ; } catch ( MissingResourceException mrEx ) { // ignore } } return translatation ; }
Translate a value into the matching one from a resource bundle in specified language .