Resource bundles contain locale-specific objects.
In this way, you can write program code that is largely independent of the user's locale isolating most, if not all, of the locale-specific information in resource bundles.
This allows you to write programs that can:
a- be easily localized, or translated, into different languages
b- handle multiple locales at once
c- be easily modified later to support even more locales
You can use the below code snippet to get key value from Resource Bundle
Import the following classes
Note resourceBundlePath should be the complete package name of your resource Bundle
For example demo.mah.view.ViewControllerBundle
Thanks
In this way, you can write program code that is largely independent of the user's locale isolating most, if not all, of the locale-specific information in resource bundles.
This allows you to write programs that can:
a- be easily localized, or translated, into different languages
b- handle multiple locales at once
c- be easily modified later to support even more locales
You can use the below code snippet to get key value from Resource Bundle
public static FacesContext getFacesContext() {
return FacesContext.getCurrentInstance();
}
public static ResourceBundle getResourceBundle(String resourceBundlePath) {
return ResourceBundle.getBundle(resourceBundlePath, getFacesContext().getViewRoot().getLocale());
}
public static Object getResourceBundleKey(String resourceBundlePath, String key) {
ResourceBundle bundle = getResourceBundle(resourceBundlePath);
return getResourceBundleKey(bundle, key);
}
private static Object getResourceBundleKey(ResourceBundle resourceBundle, String key) {
Object bundleKeyValue;
try {
bundleKeyValue = resourceBundle.getString(key);
} catch (MissingResourceException mrExp) {
bundleKeyValue = key + " not found in resource bundle";
}
return bundleKeyValue;
}
Import the following classes
import java.util.MissingResourceException;
import java.util.ResourceBundle;
import javax.faces.context.FacesContext;
Note resourceBundlePath should be the complete package name of your resource Bundle
For example demo.mah.view.ViewControllerBundle
Thanks
There's certainly a lot to find out about this subject. I love all the points you made.
ReplyDeleteFeel free to surf my webpage : site here
yurtdışı kargo
ReplyDeleteresimli magnet
instagram takipçi satın al
yurtdışı kargo
sms onay
dijital kartvizit
dijital kartvizit
https://nobetci-eczane.org/
VOLYV
salt likit
ReplyDeletesalt likit
dr mood likit
big boss likit
dl likit
dark likit
VGYM