@Named @RequestScoped public class ResourceBundleHandler extends Object
<h1>#{resourceBundleHandler.findMessage('application_title')}</h1>
The ResourceBundleHandler load the bundles based on the current user locale.
Resource bundle instances created by the getBundle factory methods are cached by default, and the factory methods return the same resource bundle instance multiple times if it has been cached. For that reason a RequestScoped bean is used here.
The class searches for the resource bundles named 'bundle.messages', 'bundle.app' and 'bundle.custom'. You can overwrite the bundle names with the imixs property value 'resourcebundle.names'. The later entries have a higher priority in case a key is stored in multiple bundles.
| Constructor and Description |
|---|
ResourceBundleHandler() |
| Modifier and Type | Method and Description |
|---|---|
String |
findMessage(String key)
This helper method findes a message by key searching all bundles.
|
String |
get(String key)
Default getter method
|
Locale |
getBrowserLocale() |
ResourceBundle |
getMessagesBundleByName(String name) |
void |
init()
This method finds the browser locale
|
@PostConstruct public void init()
public Locale getBrowserLocale()
public ResourceBundle getMessagesBundleByName(String name)
Copyright © 2006–2021 Imixs Software Solutions GmbH. All rights reserved.