mirror of
https://github.com/unicode-org/icu.git
synced 2025-04-13 08:53:20 +00:00
ICU-7919 Synchronized eclipse37 with maint-4-4 r30611 to integrate follow up fixes for #8774 (r30608).
X-SVN-Rev: 30612
This commit is contained in:
parent
701bff1db3
commit
750d7df860
9 changed files with 68 additions and 22 deletions
|
@ -131,7 +131,10 @@ public class DateFormat extends Format {
|
|||
* work correctly unless they manipulate the delegate.
|
||||
*/
|
||||
protected DateFormat() {
|
||||
this.dateFormat = java.text.DateFormat.getInstance();
|
||||
this.dateFormat = java.text.DateFormat.getDateTimeInstance(
|
||||
java.text.DateFormat.SHORT,
|
||||
java.text.DateFormat.SHORT,
|
||||
ULocale.getDefault(Category.FORMAT).toLocale());
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -897,7 +900,9 @@ public class DateFormat extends Format {
|
|||
*/
|
||||
public final static DateFormat getTimeInstance()
|
||||
{
|
||||
return new DateFormat(java.text.DateFormat.getTimeInstance());
|
||||
return new DateFormat(java.text.DateFormat.getTimeInstance(
|
||||
java.text.DateFormat.DEFAULT,
|
||||
ULocale.getDefault(Category.FORMAT).toLocale()));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -910,7 +915,9 @@ public class DateFormat extends Format {
|
|||
*/
|
||||
public final static DateFormat getTimeInstance(int style)
|
||||
{
|
||||
return new DateFormat(java.text.DateFormat.getTimeInstance(getJDKFormatStyle(style)));
|
||||
return new DateFormat(java.text.DateFormat.getTimeInstance(
|
||||
getJDKFormatStyle(style),
|
||||
ULocale.getDefault(Category.FORMAT).toLocale()));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -951,7 +958,9 @@ public class DateFormat extends Format {
|
|||
*/
|
||||
public final static DateFormat getDateInstance()
|
||||
{
|
||||
return new DateFormat(java.text.DateFormat.getDateInstance());
|
||||
return new DateFormat(java.text.DateFormat.getDateInstance(
|
||||
java.text.DateFormat.DEFAULT,
|
||||
ULocale.getDefault(Category.FORMAT).toLocale()));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -964,7 +973,9 @@ public class DateFormat extends Format {
|
|||
*/
|
||||
public final static DateFormat getDateInstance(int style)
|
||||
{
|
||||
return new DateFormat(java.text.DateFormat.getDateInstance(getJDKFormatStyle(style)));
|
||||
return new DateFormat(java.text.DateFormat.getDateInstance(
|
||||
getJDKFormatStyle(style),
|
||||
ULocale.getDefault(Category.FORMAT).toLocale()));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1005,7 +1016,10 @@ public class DateFormat extends Format {
|
|||
*/
|
||||
public final static DateFormat getDateTimeInstance()
|
||||
{
|
||||
return new DateFormat(java.text.DateFormat.getDateTimeInstance());
|
||||
return new DateFormat(java.text.DateFormat.getDateTimeInstance(
|
||||
java.text.DateFormat.DEFAULT,
|
||||
java.text.DateFormat.DEFAULT,
|
||||
ULocale.getDefault(Category.FORMAT).toLocale()));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1023,13 +1037,20 @@ public class DateFormat extends Format {
|
|||
{
|
||||
if (dateStyle != NONE) {
|
||||
if (timeStyle != NONE) {
|
||||
return new DateFormat(java.text.DateFormat.getDateTimeInstance(getJDKFormatStyle(dateStyle), getJDKFormatStyle(timeStyle)));
|
||||
return new DateFormat(java.text.DateFormat.getDateTimeInstance(
|
||||
getJDKFormatStyle(dateStyle),
|
||||
getJDKFormatStyle(timeStyle),
|
||||
ULocale.getDefault(Category.FORMAT).toLocale()));
|
||||
} else {
|
||||
return new DateFormat(java.text.DateFormat.getDateInstance(getJDKFormatStyle(dateStyle)));
|
||||
return new DateFormat(java.text.DateFormat.getDateInstance(
|
||||
getJDKFormatStyle(dateStyle),
|
||||
ULocale.getDefault(Category.FORMAT).toLocale()));
|
||||
}
|
||||
}
|
||||
if (timeStyle != NONE) {
|
||||
return new DateFormat(java.text.DateFormat.getTimeInstance(getJDKFormatStyle(timeStyle)));
|
||||
return new DateFormat(java.text.DateFormat.getTimeInstance(
|
||||
getJDKFormatStyle(timeStyle),
|
||||
ULocale.getDefault(Category.FORMAT).toLocale()));
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
@ -1090,7 +1111,10 @@ public class DateFormat extends Format {
|
|||
* @stable ICU 2.0
|
||||
*/
|
||||
public final static DateFormat getInstance() {
|
||||
return new DateFormat(java.text.DateFormat.getInstance());
|
||||
return new DateFormat(java.text.DateFormat.getDateTimeInstance(
|
||||
java.text.DateFormat.SHORT,
|
||||
java.text.DateFormat.SHORT,
|
||||
ULocale.getDefault(Category.FORMAT).toLocale()));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1434,7 +1458,7 @@ public class DateFormat extends Format {
|
|||
* @stable ICU 2.0
|
||||
*/
|
||||
static final public DateFormat getTimeInstance(Calendar cal, int timeStyle) {
|
||||
return getTimeInstance(cal, timeStyle, Locale.getDefault());
|
||||
return getTimeInstance(cal, timeStyle, ULocale.getDefault(Category.FORMAT));
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -16,6 +16,7 @@ import java.util.ResourceBundle;
|
|||
|
||||
import com.ibm.icu.util.Calendar;
|
||||
import com.ibm.icu.util.ULocale;
|
||||
import com.ibm.icu.util.ULocale.Category;
|
||||
|
||||
/**
|
||||
* {@icuenhanced java.text.DateFormatSymbols}.{@icu _usage_}
|
||||
|
@ -135,7 +136,7 @@ public class DateFormatSymbols implements Serializable, Cloneable {
|
|||
*/
|
||||
public DateFormatSymbols()
|
||||
{
|
||||
this(new java.text.DateFormatSymbols());
|
||||
this(new java.text.DateFormatSymbols(ULocale.getDefault(Category.FORMAT).toLocale()));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -176,7 +177,7 @@ public class DateFormatSymbols implements Serializable, Cloneable {
|
|||
* @stable ICU 3.8
|
||||
*/
|
||||
public static DateFormatSymbols getInstance() {
|
||||
return new DateFormatSymbols(new java.text.DateFormatSymbols());
|
||||
return new DateFormatSymbols();
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -13,6 +13,7 @@ import java.text.AttributedString;
|
|||
import java.text.CharacterIterator;
|
||||
import java.text.FieldPosition;
|
||||
import java.text.ParsePosition;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
|
||||
|
@ -20,6 +21,8 @@ import com.ibm.icu.math.BigDecimal;
|
|||
import com.ibm.icu.math.MathContext;
|
||||
import com.ibm.icu.util.Currency;
|
||||
import com.ibm.icu.util.CurrencyAmount;
|
||||
import com.ibm.icu.util.ULocale;
|
||||
import com.ibm.icu.util.ULocale.Category;
|
||||
|
||||
/**
|
||||
* {@icuenhanced java.text.DecimalFormat}.{@icu _usage_}
|
||||
|
@ -613,7 +616,19 @@ public class DecimalFormat extends NumberFormat {
|
|||
* @stable ICU 2.0
|
||||
*/
|
||||
public DecimalFormat() {
|
||||
// There is no way to construct java.text.DecimalFormat with an
|
||||
// explicit Locale.
|
||||
this(new java.text.DecimalFormat());
|
||||
|
||||
if (!ULocale.getDefault(Category.FORMAT).toLocale().equals(Locale.getDefault())) {
|
||||
// On Java 6 or older JRE, ULocale's FORMAT default might be different
|
||||
// from the locale used for constructing java.text.DecimalFormat
|
||||
java.text.NumberFormat jdkNfmt = java.text.NumberFormat.getInstance(ULocale.getDefault(Category.FORMAT).toLocale());
|
||||
if (jdkNfmt instanceof java.text.DecimalFormat) {
|
||||
((java.text.DecimalFormat)numberFormat).applyPattern(((java.text.DecimalFormat)jdkNfmt).toPattern());
|
||||
((java.text.DecimalFormat)numberFormat).setDecimalFormatSymbols(((java.text.DecimalFormat)jdkNfmt).getDecimalFormatSymbols());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -634,7 +649,9 @@ public class DecimalFormat extends NumberFormat {
|
|||
* @stable ICU 2.0
|
||||
*/
|
||||
public DecimalFormat(String pattern) {
|
||||
this(new java.text.DecimalFormat(pattern));
|
||||
this(new java.text.DecimalFormat(
|
||||
pattern,
|
||||
new java.text.DecimalFormatSymbols(ULocale.getDefault(Category.FORMAT).toLocale())));
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -12,6 +12,7 @@ import java.io.Serializable;
|
|||
import java.util.Locale;
|
||||
|
||||
import com.ibm.icu.util.ULocale;
|
||||
import com.ibm.icu.util.ULocale.Category;
|
||||
|
||||
/**
|
||||
* This class represents the set of symbols (such as the decimal separator, the
|
||||
|
@ -54,7 +55,7 @@ final public class DecimalFormatSymbols implements Cloneable, Serializable {
|
|||
* @stable ICU 2.0
|
||||
*/
|
||||
public DecimalFormatSymbols() {
|
||||
this(new java.text.DecimalFormatSymbols());
|
||||
this(new java.text.DecimalFormatSymbols(ULocale.getDefault(Category.FORMAT).toLocale()));
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -26,6 +26,7 @@ import java.util.Map.Entry;
|
|||
import java.util.Set;
|
||||
|
||||
import com.ibm.icu.util.ULocale;
|
||||
import com.ibm.icu.util.ULocale.Category;
|
||||
|
||||
/**
|
||||
* {@icuenhanced java.text.MessageFormat}.{@icu _usage_}
|
||||
|
@ -437,7 +438,7 @@ public class MessageFormat extends UFormat {
|
|||
* @stable ICU 3.0
|
||||
*/
|
||||
public MessageFormat(String pattern) {
|
||||
this(new java.text.MessageFormat(pattern));
|
||||
this(new java.text.MessageFormat(pattern, ULocale.getDefault(Category.FORMAT).toLocale()));
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -1137,13 +1137,13 @@ public class NumberFormat extends Format {
|
|||
}
|
||||
|
||||
/**
|
||||
* Empty constructor. Public for compatibily with JDK which lets the
|
||||
* Empty constructor. Public for compatibility with JDK which lets the
|
||||
* compiler generate a default public constructor even though this is
|
||||
* an abstract class.
|
||||
* @stable ICU 2.6
|
||||
*/
|
||||
public NumberFormat() {
|
||||
this(java.text.NumberFormat.getInstance());
|
||||
this(java.text.NumberFormat.getInstance(ULocale.getDefault(Category.FORMAT).toLocale()));
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -1172,7 +1172,7 @@ public class Calendar implements Serializable, Cloneable, Comparable<Calendar> {
|
|||
*/
|
||||
public static synchronized Calendar getInstance()
|
||||
{
|
||||
return new Calendar(java.util.Calendar.getInstance());
|
||||
return new Calendar(java.util.Calendar.getInstance(ULocale.getDefault(Category.FORMAT).toLocale()));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1183,7 +1183,7 @@ public class Calendar implements Serializable, Cloneable, Comparable<Calendar> {
|
|||
*/
|
||||
public static synchronized Calendar getInstance(TimeZone zone)
|
||||
{
|
||||
return new Calendar(java.util.Calendar.getInstance(zone.timeZone));
|
||||
return new Calendar(java.util.Calendar.getInstance(zone.timeZone, ULocale.getDefault(Category.FORMAT).toLocale()));
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -11,6 +11,8 @@ import java.text.ParsePosition;
|
|||
import java.util.Date;
|
||||
import java.util.Locale;
|
||||
|
||||
import com.ibm.icu.util.ULocale.Category;
|
||||
|
||||
/**
|
||||
* A class encapsulating a currency, as defined by ISO 4217. A
|
||||
* <tt>Currency</tt> object can be created given a <tt>Locale</tt> or
|
||||
|
@ -230,7 +232,7 @@ public class Currency implements Serializable {
|
|||
* @stable ICU 3.4
|
||||
*/
|
||||
public String getSymbol() {
|
||||
return currency.getSymbol();
|
||||
return currency.getSymbol(ULocale.getDefault(Category.DISPLAY).toLocale());
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -322,7 +322,7 @@ public class TimeZone implements Serializable, Cloneable {
|
|||
* @stable ICU 2.0
|
||||
*/
|
||||
public final String getDisplayName() {
|
||||
return timeZone.getDisplayName();
|
||||
return timeZone.getDisplayName(ULocale.getDefault(Category.DISPLAY).toLocale());
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Add table
Reference in a new issue