public class L10NManager extends Object
The localization manager allows adapting values for display in different locales thru parsing and formatting
capabilities (similar to JavaSE's DateFormat/NumberFormat). It also includes language/locale/currency
related API's similar to Locale/currency API's from JavaSE.
The sample code below just lists the various capabilities of the API:
Modifier | Constructor and Description |
---|---|
protected |
L10NManager(String language,
String locale)
Instances of this class should be received via the Display class
|
Modifier and Type | Method and Description |
---|---|
String |
format(double number)
Format a double number for this locale
|
String |
format(double number,
int decimalPlaces)
Formats a number as a String with a fixed number of decimal places
|
String |
format(int number)
Format an integer number for this locale
|
String |
formatCurrency(double currency)
Format a currency value
|
String |
formatDateLongStyle(Date d)
Formats a date in a long form e.g.
|
String |
formatDateShortStyle(Date d)
Formats a date in a short form e.g.
|
String |
formatDateTime(Date d)
Formats a date and a time in a default form e.g.
|
String |
formatDateTimeMedium(Date d)
Formats a date and a time in a default form e.g.
|
String |
formatDateTimeShort(Date d)
Formats a date and a time in a default form e.g.
|
String |
formatTime(Date d)
Formats the time in a default form e.g.
|
String |
getCurrencySymbol()
Returns the currency symbol for this locale
|
static L10NManager |
getInstance()
Convenience method that invokes Display.getLocalizationManager()
|
String |
getLanguage()
Returns the current locale language as an ISO 639 two letter code
|
String |
getLocale()
Determines the locale (location) as an ISO 3166 country code
|
String |
getLongMonthName(Date date)
Gets the long month name in the current locale for the given date.
|
String |
getShortMonthName(Date date)
Gets the short month name in the current locale for the given date.
|
boolean |
isRTLLocale()
Indicates whether the language is a right to left language
|
double |
parseCurrency(String amount)
Parses the currency value
|
double |
parseDouble(String localeFormattedDecimal)
Parses a double based on locale conventions
|
int |
parseInt(String localeFormattedInteger)
Parses an integer based on locale conventions
|
long |
parseLong(String localeFormattedLong)
Parses a long based on locale conventions
|
void |
setLocale(String locale,
String language)
Forces the locale/language
|
public String getLanguage()
public void setLocale(String locale, String language)
locale
- the new localelanguage
- the language to usepublic String format(int number)
number
- the number to formatpublic String format(double number)
number
- the number to formatpublic String getShortMonthName(Date date)
date
- The date.public String getLongMonthName(Date date)
date
- The date.public String formatCurrency(double currency)
currency
- the monetary valuepublic String getCurrencySymbol()
public String formatDateLongStyle(Date d)
d
- the datepublic String formatDateShortStyle(Date d)
d
- the datepublic String formatDateTime(Date d)
d
- the datepublic String formatDateTimeMedium(Date d)
d
- the datepublic String formatTime(Date d)
d
- the date time objectpublic String formatDateTimeShort(Date d)
d
- the datepublic boolean isRTLLocale()
public String getLocale()
public static L10NManager getInstance()
public String format(double number, int decimalPlaces)
number
- the numberdecimalPlaces
- decimalspublic double parseDouble(String localeFormattedDecimal)
localeFormattedDecimal
- the locale formatted numberpublic long parseLong(String localeFormattedLong)
localeFormattedLong
- the numberpublic int parseInt(String localeFormattedInteger)
localeFormattedInteger
- the numberpublic double parseCurrency(String amount)
amount
- the amount