public class Locale extends Object implements DataConverter
Modifier and Type | Field and Description |
---|---|
static int |
AM_PM
The full name of the AM/PM.
|
static int |
COUNTRY
The full name of the locale country.
|
static int |
COUNTRY_ENGLISH
The full English name of the locale country.
|
static int |
COUNTRY_NATIVE
The full native name of the locale country.
|
static int |
COUNTRY_SHORT
The short name of the locale country.
|
static int |
CURRENCY |
static int |
CurrencyDecimalSeparator |
static int |
CurrencyDigits |
static int |
CurrencyGrouping |
static int |
CurrencySymbol |
static int |
CurrencyThousandsSeparator |
static int |
DATE_SEPARATOR
The character(s) for the date separator.
|
static int |
DAY
The full name of the day which is equivalent to Monday - Sunday, where 1 == Monday, 2 == Tuesday
etc.
|
static int |
DAY_OF_WEEK
The full name of a DAY IN THE WEEK.
|
static int |
DecimalSeparator |
static int |
defaultID
This is the ID to use as the default locale identifier.
|
static int |
DigitGrouping |
static int |
FIRST_DAY_OF_WEEK
The index of the first day of the week. 1 = Monday, 2 = Tuesday, etc.
|
static int |
FORCE_CREATION
This is an options for createFor() it tells the system
to create a Locale that always reports the specified language and country
even if the Locale is not actually supported by the underlying system.
|
static int |
FORMAT_NO_ROUNDING
Option for format() method.
|
static int |
FORMAT_PARSE_CURRENCY
Parameter for format() or parse() method, used when formating a currency value.
|
static int |
FORMAT_PARSE_DATE
Parameter for format() or parse() method, used when formating a date value.
|
static int |
FORMAT_PARSE_NUMBER
Parameter for format() or parse() method, used when formating a numeric value.
|
static int |
FractionalDigits |
static int |
HAS_WILD_CARDS
A compare option.
|
static int |
IGNORE_CASE
An option for getStringComparer.
|
static int |
IGNORE_NONSPACE
An option for getStringComparer.
|
static int |
IGNORE_SYMBOLS
An option for getStringComparer.
|
static int |
InternationalCurrencyDigits |
static int |
InternationalCurrencySymbol |
static int |
LANGUAGE
The full name of the locale language.
|
static int |
LANGUAGE_ENGLISH
The ISO English name of the locale language.
|
static int |
LANGUAGE_NATIVE
The full native name of the locale language.
|
static int |
LANGUAGE_SHORT
The ISO short name of the locale language.
|
static int |
LeadingZeros |
static int |
ListSeparator |
static int |
LOCALE_NEUTRAL
This is the native Win32 definition of a Neutral locale.
|
static int |
LOCALE_SYSTEM_DEFAULT
This is the native Win32 definition of the system default locale.
|
static int |
LOCALE_USER_DEFAULT
This is the native Win32 definition of the user default locale.
|
static int |
LONG_DATE_FORMAT
The format for the long date display.
|
static int |
MONTH
The full name of a month.
|
static int |
MONTH_YEAR_FORMAT
The correct format for display month and year only.
|
protected Locale |
myLocale |
static int |
NativeDigits |
static int |
NegativeCurrencyMode |
static int |
NegativeNumberMode |
static int |
NegativeSign |
static int |
PositiveCurrencyMode |
static int |
PositiveSign |
static int |
SHORT_DATE_FORMAT
The format for the short date display.
|
static int |
SHORT_DAY
The short name of the day which is equivalent to Monday - Sunday, where 1 == Monday, 2 == Tuesday
etc.
|
static int |
SHORT_DAY_OF_WEEK
The short name of a DAY IN THE WEEK.
|
static int |
SHORT_MONTH
The short name of a month.
|
static int |
ThousandsSeparator |
static int |
TIME_FORMAT
The format for the time display.
|
static int |
TIME_SEPARATOR
The character(s) for the time separator.
|
static String |
unknownString
This is the value that will be returned by getString() in some instances if the
value is not known.
|
static int |
USMeasurment |
Constructor and Description |
---|
Locale() |
Locale(boolean dontSetId)
This creates a Locale without an ID.
|
Locale(int id) |
Locale(Locale locale,
boolean forceSupport)
Create a Locale from a non-null java.util.Locale.
|
Locale(String language,
String country,
boolean forceSupport) |
Modifier and Type | Method and Description |
---|---|
static int |
calendarDayToLocaleDay(int calendarDay)
This converts the Calendar constants SUNDAY to SATURDAY to the locale representations
of these values in the range 1 to 7, where 1 = Monday and 7 = Sunday.
|
static int |
calendarMonthToLocaleMonth(int calendarMonth)
This converts the Calendar constants JANUARY to UNDECIMBER to the locale representations
of these values in the range 1 to 13, where 1 = January and 13 = UNDECIMBER
|
void |
changeCase(char[] ch,
int start,
int length,
boolean toUpper) |
char |
changeCase(char c,
boolean toUpper)
This converts the character to either upper case or lower case.
|
int |
compare(char[] one,
int oneOffset,
int oneLength,
char[] two,
int twoOffset,
int twoLength,
int options)
Compare two character arrays. options can be IGNORE_CASE.
|
int |
compare(char one,
char two,
int options)
Compare two characters. options can be IGNORE_CASE.
|
int |
compare(String one,
String two,
int options) |
static String |
convertCountryCode(String countryCode)
This will convert a three letter (uppercase) ISO country code to the two letter (uppercase) ISO country code
OR the other way.
|
boolean |
convertData(Wrapper source,
Class sourceType,
Wrapper dest,
Class destType)
Return true if the conversion was successfull.
|
static Locale |
createFor(String language,
String country,
int options) |
static int |
createID(String language,
String country,
int options)
(Not implemented) This should create a locale based on
the ISO two character language and country codes.
|
boolean |
equals(Object other)
Returns if this object is considered equal to the other object.
|
CharArray |
format(double value,
String format,
CharArray destination,
int options) |
String |
format(double value,
String format,
int options) |
CharArray |
format(int value,
String format,
CharArray destination,
int options) |
String |
format(int value,
String format,
int options) |
CharArray |
format(long value,
String format,
CharArray destination,
int options) |
String |
format(long value,
String format,
int options) |
CharArray |
formatCurrency(double value,
String format,
CharArray destination,
int options) |
String |
formatCurrency(double value,
String format,
int options) |
static Locale |
fromJavaLocale(Locale locale)
Get a re-used eve.sys.Locale from a java.util.Locale.
|
int |
fromString(int what,
char[] chars,
int offset,
int length,
int options) |
int |
fromString(int what,
String str,
int options)
This is the reverse of getString() - it takes a locale dependent string
and returns the value associated with it.
|
static int[] |
getAllIDs(int options) |
int |
getCalendarForMonth(Time time,
int[] dayOfWeekLayout,
int[] dayOfMonthLayout,
boolean wrapAround)
Get the calendar layout for the month/year that the specified Time is currently set for.
|
static Locale |
getDefault() |
String |
getString(int what)
This is the same as getString(what,0,0);
|
String |
getString(int what,
int forValue,
int options)
"what" should be one of MONTH, SHORT_MONTH, etc..
|
String |
getString(int what,
String defaultValue) |
Comparer |
getStringComparer(int options)
Get a locale specific string comparer.
|
int |
hashCode()
Returns a hashCode for the object.
|
static int |
localeDayToCalendarDay(int localeDay)
This converts locale values in the range 1 to 7, where 1 = Monday and 7 = Sunday
into the Calendar constants SUNDAY to SATURDAY.
|
static int |
localeMonthToCalendarMonth(int localeMonth)
This converts locale values in the range 1 to 13, where 1 = January and 13 = Undecimber
into the Calendar constants JANUARY to UNDECIMBER.
|
static void |
main(String[] args) |
double |
parseCurrency(char[] value,
int offset,
int length,
String format) |
double |
parseCurrency(String value,
String format) |
double |
parseDouble(char[] value,
int offset,
int length,
String format) |
double |
parseDouble(String value,
String format) |
int |
parseInt(char[] value,
int offset,
int length,
String format) |
int |
parseInt(String value,
String format) |
long |
parseLong(char[] value,
int offset,
int length,
String format) |
long |
parseLong(String value,
String format) |
void |
set(int id) |
static boolean |
setDefault(String language,
String country,
int options)
This attempts to set what the default language and (optionally) country for the
application.
|
Locale |
toJavaLocale() |
String |
toString()
This returns an object which implements LocalResource.
|
static boolean |
unknown(String value)
This checks if the value is either null or the unknownString.
|
protected Locale myLocale
public static final int MONTH
public static final int SHORT_MONTH
public static final int DAY_OF_WEEK
public static final int SHORT_DAY_OF_WEEK
public static final int CURRENCY
public static final int AM_PM
public static final int DAY
public static final int SHORT_DAY
public static final int FIRST_DAY_OF_WEEK
public static final int LANGUAGE
public static final int LANGUAGE_ENGLISH
public static final int LANGUAGE_NATIVE
public static final int LANGUAGE_SHORT
public static final int TIME_SEPARATOR
public static final int DATE_SEPARATOR
public static final int TIME_FORMAT
public static final int SHORT_DATE_FORMAT
public static final int LONG_DATE_FORMAT
public static final int MONTH_YEAR_FORMAT
public static final int COUNTRY
public static final int COUNTRY_ENGLISH
public static final int COUNTRY_NATIVE
public static final int COUNTRY_SHORT
public static final int FORMAT_PARSE_NUMBER
public static final int FORMAT_PARSE_CURRENCY
public static final int FORMAT_PARSE_DATE
public static final int FORMAT_NO_ROUNDING
public static final int LOCALE_NEUTRAL
public static final int LOCALE_USER_DEFAULT
public static final int LOCALE_SYSTEM_DEFAULT
public static int defaultID
public static final String unknownString
public static final int ListSeparator
public static final int USMeasurment
public static final int DecimalSeparator
public static final int ThousandsSeparator
public static final int DigitGrouping
public static final int FractionalDigits
public static final int LeadingZeros
public static final int NegativeNumberMode
public static final int NativeDigits
public static final int CurrencySymbol
public static final int InternationalCurrencySymbol
public static final int CurrencyDecimalSeparator
public static final int CurrencyThousandsSeparator
public static final int CurrencyGrouping
public static final int CurrencyDigits
public static final int InternationalCurrencyDigits
public static final int PositiveCurrencyMode
public static final int NegativeCurrencyMode
public static final int PositiveSign
public static final int NegativeSign
public static final int FORCE_CREATION
public static final int IGNORE_CASE
public static final int IGNORE_NONSPACE
public static final int IGNORE_SYMBOLS
public static final int HAS_WILD_CARDS
public Locale(boolean dontSetId)
public Locale(Locale locale, boolean forceSupport) throws IllegalArgumentException
locale
- the Java Locale.forceSupport
- set this true if you want to force support for the locale.IllegalArgumentException
- if the locale is not supported and forceSupport is false.public Locale(String language, String country, boolean forceSupport) throws IllegalArgumentException
IllegalArgumentException
public Locale()
public Locale(int id)
public static boolean unknown(String value)
public static Locale getDefault()
public static String convertCountryCode(String countryCode)
public static Locale fromJavaLocale(Locale locale)
locale
- the non-null java.util.Locale to get a corresponding eve.sys.Locale.public static boolean setDefault(String language, String country, int options)
language
- The two letter language code.country
- The three letter country code (optional).options
- If FORCE_CREATION is used as an option BUT the specified language/country does is not supported,
then the default locale will
still report this language and country as its language and country
but will not be able to provide any other info or services.public void set(int id)
public static int createID(String language, String country, int options)
language
- the ISO-639 two character language specifier.country
- the ISO-3166 three character country specifier.options
- options for creating the ID. None are defined yet.public static Locale createFor(String language, String country, int options)
language
- the ISO-639 two character language specifier.country
- the ISO-3166 three character country specifier.options
- options for creating the ID. The only supported option is FORCE_CREATIONpublic String getString(int what, int forValue, int options)
public String getString(int what)
public int fromString(int what, String str, int options)
what
- should be one of MONTH, SHORT_MONTH, DAY, SHORT_DAY or AM_PMstr
- should be a string to parse.options
- options for getting the information. None are defined yet.public int fromString(int what, char[] chars, int offset, int length, int options)
public static int[] getAllIDs(int options)
public Comparer getStringComparer(int options)
public int compare(char one, char two, int options)
public int compare(char[] one, int oneOffset, int oneLength, char[] two, int twoOffset, int twoLength, int options)
public char changeCase(char c, boolean toUpper)
public void changeCase(char[] ch, int start, int length, boolean toUpper)
public String toString()
public int getCalendarForMonth(Time time, int[] dayOfWeekLayout, int[] dayOfMonthLayout, boolean wrapAround)
time
- the Time specifying the month and year required.dayOfWeekLayout
- an array of 7 ints which will contain values from 1 = Monday to 7 = Sunday
in the appropriate location for the day of the week for the locale. The value at index 0
will be the first day of the week in this locale (which may be Monday, Sunday or possibly Saturday).dayOfMonthLayout
- an array of 35 or 42 integers where the values 1 to 31 will be stored with
1 being stored within the range 0 to 6 depending on what day it is in. The values 2, 3 etc
will follow sequentially from 1. It is possible that the values 31 and 30 may wrap around
and be placed at indexes 0 and 1 if wrapAround is true. Locations where there are no days will be set to 0.wrapAround
- if this is true then if the index of values 31 and/or 30 exceed 35 then they
will be wrapped to 0.public static int calendarDayToLocaleDay(int calendarDay)
public static int localeDayToCalendarDay(int localeDay)
public static int calendarMonthToLocaleMonth(int calendarMonth)
public static int localeMonthToCalendarMonth(int localeMonth)
public Locale toJavaLocale()
public int parseInt(char[] value, int offset, int length, String format) throws NumberFormatException
NumberFormatException
public long parseLong(char[] value, int offset, int length, String format) throws NumberFormatException
NumberFormatException
public double parseDouble(char[] value, int offset, int length, String format) throws NumberFormatException
NumberFormatException
public double parseCurrency(char[] value, int offset, int length, String format) throws NumberFormatException
NumberFormatException
public int parseInt(String value, String format) throws NumberFormatException
NumberFormatException
public long parseLong(String value, String format) throws NumberFormatException
NumberFormatException
public double parseDouble(String value, String format) throws NumberFormatException
NumberFormatException
public double parseCurrency(String value, String format) throws NumberFormatException
NumberFormatException
public CharArray formatCurrency(double value, String format, CharArray destination, int options)
public boolean convertData(Wrapper source, Class sourceType, Wrapper dest, Class destType)
DataConverter
convertData
in interface DataConverter
public int hashCode()
Object
public boolean equals(Object other)
Object
public static void main(String[] args)