| java.lang.Object l10ndemo.LocalizationSupport
LocalizationSupport | public class LocalizationSupport (Code) | | This class contains a localization support for MIDP applications
Feel free to modify.
author: breh version: 1.0 |
Method Summary | |
public static String | getErrorMessage() Returns an error message if there was any problem with accessing the localized
text. | final public static String | getMessage(String key) Finds a localized string in a message bundle.
Parameters: key - key of the localized string to look for the localized string. | final public static String | getMessage(String key, Object[] args) Finds a localized string in a message bundle and formats the message by passing
requested parameters.
Parameters: key - key of the localized string to look for Parameters: args - array of arguments to use for formatting the message the localized string. | public static boolean | initLocalizationSupport() Initializes localization support based on currently set locale (obtained
from "microedition.locale" system property). | public static boolean | initLocalizationSupport(String locale) Explicit initialization of the localization support. |
getErrorMessage | public static String getErrorMessage()(Code) | | Returns an error message if there was any problem with accessing the localized
text. The message also possibly explainins a reason of the failure. The message
is taken from _INIT_LOCALIZATION_ERROR_MSG .
error message if there was any failure or null when everything is OK. |
getMessage | final public static String getMessage(String key)(Code) | | Finds a localized string in a message bundle.
Parameters: key - key of the localized string to look for the localized string. If key is not found, then _DEFAULT_STRING stringis returned |
getMessage | final public static String getMessage(String key, Object[] args)(Code) | | Finds a localized string in a message bundle and formats the message by passing
requested parameters.
Parameters: key - key of the localized string to look for Parameters: args - array of arguments to use for formatting the message the localized string. If key is not found, then _DEFAULT_STRING stringis returned |
initLocalizationSupport | public static boolean initLocalizationSupport()(Code) | | Initializes localization support based on currently set locale (obtained
from "microedition.locale" system property). The initialization method is called
automatically when a call to
LocalizationSupport.getMessage(java.lang.String) method is attempted for the first time.
You can call this method explicitly to see whether there was any problem
with initialization of the localization support. Method returns a status
of the successfulness. If there was any problem with initialization, you can
get reason by using
LocalizationSupport.getErrorMessage() method.
true if the intialization was succesfull, false if there was any problem. |
initLocalizationSupport | public static boolean initLocalizationSupport(String locale)(Code) | | Explicit initialization of the localization support. This method is usually
called when a particular locale used in the application. E.g. the application
contains only french messages (no default messages, only messages_fr.properties
files is available), you should initialize the localization support (by calling
initLocalizationSupport("fr"); ) before using
LocalizationSupport.getMessage(java.lang.String) method for the first
time.
Method returns a status of the successfulness. If there was any problem with
the initialization, you can get explanation by using
LocalizationSupport.getErrorMessage() method.
Parameters: locale - locale which will be used to determine which message file from bundle will be used true if the intialization was succesfull, false if there was any problem. |
|
|