public class ResourceBundleLocalizationCallback extends Object implements LocalizationCallback
LocalizationCallback
) for registration with the
Adapter Framework.
This implementation will look up any string it receives for localization
through localizeString
in a given resource bundle and return the
lookup result (or the original string if the lookup failed) as localized
string.
LocalizationCallback
,
ResourceBundle
Constructor and Description |
---|
ResourceBundleLocalizationCallback(String rbName,
ClassLoader classLoader)
Constructs a
ResourceBundleLocalizationCallback instance
with a class loader used to load the resource bundle. |
Modifier and Type | Method and Description |
---|---|
String |
localizeString(String source,
Locale targetLocale)
Requests an adapter to localize a given string into a target locale.
|
public ResourceBundleLocalizationCallback(String rbName, ClassLoader classLoader)
ResourceBundleLocalizationCallback
instance
with a class loader used to load the resource bundle. Make sure to specify
a class loader (typically the adapter's class loader that can be obtained
by calling getClass().getClassLoader()
on any of the classes
that make up the adapter) that the resource bundle is actually visible in.rbName
- the base name of the resource bundle to useclassLoader
- the class loader to use when loading the resource bundleResourceBundle
public String localizeString(String source, Locale targetLocale) throws LocalizationNotPossibleException
LocalizationCallback
If the adapter is unable to support the requested target locale, the
source string should be localized into English. If English is not
available as a target locale either, the adapter needs to throw a
LocalizationNotPossibleException
.
localizeString
in interface LocalizationCallback
source
- the string to be localizedtargetLocale
- the target locale to localize the string toLocalizationNotPossibleException
- if the string could not be localizedAccess Rights |
---|
SC | DC | Public Part | ACH |
---|---|---|---|
[sap.com] SAP_XIAF
|
[sap.com] com.sap.aii.af.svc.facade
|
api
|
BC-XI
|
Copyright 2019 SAP AG Complete Copyright Notice