java.util

Class Locale

Implemented Interfaces:
Cloneable, Serializable

public final class Locale
extends Object
implements Cloneable, Serializable

A Locale object represents a specific geographical, political, or cultural region. An operation that requires a Locale to perform its task is called locale-sensitive and uses the Locale to tailor information for the user. For example, displaying a number is a locale-sensitive operation--the number should be formatted according to the customs/conventions of the user's native country, region, or culture.

Create a Locale object using the constructors in this class:

 Locale(String language)
 Locale(String language, String country)
 Locale(String language, String country, String variant)
 
The language argument is a valid ISO Language Code. These codes are the lower-case, two-letter codes as defined by ISO-639. You can find a full list of these codes at a number of sites, such as:
http://www.loc.gov/standards/iso639-2/englangn.html

The country argument is a valid ISO Country Code. These codes are the upper-case, two-letter codes as defined by ISO-3166. You can find a full list of these codes at a number of sites, such as:
http://www.iso.ch/iso/en/prods-services/iso3166ma/02iso-3166-code-lists/list-en1.html

The variant argument is a vendor or browser-specific code. For example, use WIN for Windows, MAC for Macintosh, and POSIX for POSIX. Where there are two variants, separate them with an underscore, and put the most important one first. For example, a Traditional Spanish collation might construct a locale with parameters for language, country and variant as: "es", "ES", "Traditional_WIN".

Because a Locale object is just an identifier for a region, no validity check is performed when you construct a Locale. If you want to see whether particular resources are available for the Locale you construct, you must query those resources. For example, ask the NumberFormat for the locales it supports using its getAvailableLocales method.
Note: When you ask for a resource for a particular locale, you get back the best available match, not necessarily precisely what you asked for. For more information, look at ResourceBundle.

The Locale class provides a number of convenient constants that you can use to create Locale objects for commonly used locales. For example, the following creates a Locale object for the United States:

 Locale.US
 

Once you've created a Locale you can query it for information about itself. Use getCountry to get the ISO Country Code and getLanguage to get the ISO Language Code. You can use getDisplayCountry to get the name of the country suitable for displaying to the user. Similarly, you can use getDisplayLanguage to get the name of the language suitable for displaying to the user. Interestingly, the getDisplayXXX methods are themselves locale-sensitive and have two versions: one that uses the default locale and one that uses the locale specified as an argument.

The Java 2 platform provides a number of classes that perform locale-sensitive operations. For example, the NumberFormat class formats numbers, currency, or percentages in a locale-sensitive manner. Classes such as NumberFormat have a number of convenience methods for creating a default object of that type. For example, the NumberFormat class provides these three convenience methods for creating a default NumberFormat object:

 NumberFormat.getInstance()
 NumberFormat.getCurrencyInstance()
 NumberFormat.getPercentInstance()
 
These methods have two variants; one with an explicit locale and one without; the latter using the default locale.
 NumberFormat.getInstance(myLocale)
 NumberFormat.getCurrencyInstance(myLocale)
 NumberFormat.getPercentInstance(myLocale)
 
A Locale is the mechanism for identifying the kind of object (NumberFormat) that you would like to get. The locale is just a mechanism for identifying objects, not a container for the objects themselves.
Since:
1.1
See Also:
ResourceBundle, Format, NumberFormat, Collator, Serialized Form

Field Summary

static Locale
CANADA
Useful constant for country.
static Locale
CANADA_FRENCH
Useful constant for country.
static Locale
CHINA
Useful constant for country.
static Locale
CHINESE
Useful constant for language.
static Locale
ENGLISH
Useful constant for language.
static Locale
FRANCE
Useful constant for country.
static Locale
FRENCH
Useful constant for language.
static Locale
GERMAN
Useful constant for language.
static Locale
GERMANY
Useful constant for country.
static Locale
ITALIAN
Useful constant for language.
static Locale
ITALY
Useful constant for country.
static Locale
JAPAN
Useful constant for country.
static Locale
JAPANESE
Useful constant for language.
static Locale
KOREA
Useful constant for country.
static Locale
KOREAN
Useful constant for language.
static Locale
PRC
Useful constant for country.
static Locale
SIMPLIFIED_CHINESE
Useful constant for language.
static Locale
TAIWAN
Useful constant for country.
static Locale
TRADITIONAL_CHINESE
Useful constant for language.
static Locale
UK
Useful constant for country.
static Locale
US
Useful constant for country.

Constructor Summary

Locale(String language)
Construct a locale from a language code.
Locale(String language, String country)
Construct a locale from language, country.
Locale(String language, String country, String variant)
Construct a locale from language, country, variant.

Method Summary

Object
clone()
Overrides Cloneable
boolean
equals(Object obj)
Returns true if this Locale is equal to another object.
static Locale[]
getAvailableLocales()
Returns an array of all installed locales.
String
getCountry()
Returns the country/region code for this locale, which will either be the empty string or an uppercase ISO 3166 2-letter code.
static Locale
getDefault()
Gets the current value of the default locale for this instance of the Java Virtual Machine.
String
getDisplayCountry()
Returns a name for the locale's country that is appropriate for display to the user.
String
getDisplayCountry(Locale inLocale)
Returns a name for the locale's country that is appropriate for display to the user.
String
getDisplayLanguage()
Returns a name for the locale's language that is appropriate for display to the user.
String
getDisplayLanguage(Locale inLocale)
Returns a name for the locale's language that is appropriate for display to the user.
String
getDisplayName()
Returns a name for the locale that is appropriate for display to the user.
String
getDisplayName(Locale inLocale)
Returns a name for the locale that is appropriate for display to the user.
String
getDisplayVariant()
Returns a name for the locale's variant code that is appropriate for display to the user.
String
getDisplayVariant(Locale inLocale)
Returns a name for the locale's variant code that is appropriate for display to the user.
String
getISO3Country()
Returns a three-letter abbreviation for this locale's country.
String
getISO3Language()
Returns a three-letter abbreviation for this locale's language.
static String[]
getISOCountries()
Returns a list of all 2-letter country codes defined in ISO 3166.
static String[]
getISOLanguages()
Returns a list of all 2-letter language codes defined in ISO 639.
String
getLanguage()
Returns the language code for this locale, which will either be the empty string or a lowercase ISO 639 code.
String
getVariant()
Returns the variant code for this locale.
int
hashCode()
Override hashCode.
static void
setDefault(Locale newLocale)
Sets the default locale for this instance of the Java Virtual Machine.
String
toString()
Getter for the programmatic name of the entire locale, with the language, country and variant separated by underbars.

Methods inherited from class java.lang.Object

clone, equals, extends Object> getClass, finalize, hashCode, notify, notifyAll, toString, wait, wait, wait

Field Details

CANADA

public static final Locale CANADA
Useful constant for country.
Usages and Demos :

View More Examples of CANADA
   1:       if (argv[0].equalsIgnoreCase("canada"))
   2:         java.util.Locale.setDefault(java.util.Locale.CANADA);
   3:       if (argv[0].equalsIgnoreCase("canada_french"))
   4:         ...
   5:         java.util.Locale.setDefault(java.util.Locale.CANADA_FRENCH);
   6:       if (argv[0].equalsIgnoreCase("china"))
   7:         ...
   8:         java.util.Locale.setDefault(java.util.Locale.CHINA);
   9:       if (argv[0].equalsIgnoreCase("france"))
  10:         ...
  11:         java.util.Locale.setDefault(java.util.Locale.FRANCE);

View Full Code Here
   1:         {
   2:             s_loc = Locale.getDefault();
   3:         ...
   4:             Locale.setDefault(Locale.US);
   5:             crs = new CCachedRowSet();
   6:         ...
   7:             Locale.setDefault(s_loc);
   8:         }
   9:         ...
  10:         {
  11:             Locale.setDefault(Locale.CANADA);

View Full Code Here
   1: 
   2: import java.util.Locale;
   3: import java.util.Properties;
   4:         ...
   5: 
   6:         Locale.setDefault(expectGermanFallback ? Locale.GERMAN : Locale.CANADA);
   7:         ...
   8:         assertEquals("message1", ac.getMessage("code1", null, Locale.ENGLISH));
   9:         assertEquals(fallbackToSystemLocale && expectGermanFallback ? "nachricht2" : "message2",
  10:         ...
  11:                 ac.getMessage("code2", null, Locale.ENGLISH));

View Full Code Here
   1: import java.util.List;
   2: import java.util.Locale;
   3: 
   4:         ...
   5:         MockHttpServletRequest request = (MockHttpServletRequest) pc.getRequest();
   6:         request.addPreferredLocale(Locale.CANADA);
   7:         final StringBuffer message = new StringBuffer();
   8:         MessageTag tag = new MessageTag() {
   9:             protected void writeMessage(String msg) {

View Full Code Here
   1: import java.util.HashMap;
   2: import java.util.Locale;
   3: import java.util.Map;
   4:         ...
   5:         req.getLocale();
   6:         reqControl.setReturnValue(Locale.CANADA);
   7:         reqControl.replay();
   8:         ...
   9:                 DateTool dateTool = (DateTool) context.get("dateTool");
  10:                 assertTrue(dateTool.getLocale().equals(Locale.CANADA));
  11: 
  12:         ...
  13:                 NumberTool numberTool = (NumberTool) context.get("numberTool");
  14:                 assertTrue(numberTool.getLocale().equals(Locale.CANADA));

View Full Code Here

CANADA_FRENCH

public static final Locale CANADA_FRENCH
Useful constant for country.
Usages and Demos :

View More Examples of CANADA_FRENCH
   1: 
   2: import java.util.Locale;
   3: 
   4:         ...
   5: 
   6:         tl.setLocale(Locale.KOREAN);
   7: 
   8:         ...
   9:         assertSame(Locale.KOREAN, tl.getLocale());
  10: 
  11:         ...
  12: 
  13:         tl.setLocale(Locale.CANADA_FRENCH);

View Full Code Here
   1:       if (argv[0].equalsIgnoreCase("canada"))
   2:         java.util.Locale.setDefault(java.util.Locale.CANADA);
   3:       if (argv[0].equalsIgnoreCase("canada_french"))
   4:         ...
   5:         java.util.Locale.setDefault(java.util.Locale.CANADA_FRENCH);
   6:       if (argv[0].equalsIgnoreCase("china"))
   7:         ...
   8:         java.util.Locale.setDefault(java.util.Locale.CHINA);
   9:       if (argv[0].equalsIgnoreCase("france"))
  10:         ...
  11:         java.util.Locale.setDefault(java.util.Locale.FRANCE);

View Full Code Here
   1: import java.net.URL;
   2: import java.util.Locale;
   3: 
   4:         ...
   5: 
   6:         Resource l = r.forLocale(Locale.FRENCH);
   7: 
   8:         ...
   9: 
  10:         Resource l = r.forLocale(Locale.CANADA_FRENCH);
  11: 
  12:         ...
  13: 
  14:         Resource l = r.forLocale(Locale.JAPANESE);

View Full Code Here

CHINA

public static final Locale CHINA
Useful constant for country.
Usages and Demos :

View More Examples of CHINA
   1: 
   2: import java.util.Locale;
   3: 
   4:         ...
   5:         case 0 :
   6:             request.getSession().setAttribute(Globals.LOCALE_KEY,Locale.CHINA);
   7:             break;
   8:         ...
   9:         case 1:
  10:             request.getSession().setAttribute(Globals.LOCALE_KEY, Locale.JAPAN);
  11:             break;
  12:         ...
  13:         case 2:
  14:             request.getSession().setAttribute(Globals.LOCALE_KEY, Locale.ENGLISH);

View Full Code Here
   1:       if (argv[0].equalsIgnoreCase("canada"))
   2:         java.util.Locale.setDefault(java.util.Locale.CANADA);
   3:       if (argv[0].equalsIgnoreCase("canada_french"))
   4:         ...
   5:         java.util.Locale.setDefault(java.util.Locale.CANADA_FRENCH);
   6:       if (argv[0].equalsIgnoreCase("china"))
   7:         ...
   8:         java.util.Locale.setDefault(java.util.Locale.CHINA);
   9:       if (argv[0].equalsIgnoreCase("france"))
  10:         ...
  11:         java.util.Locale.setDefault(java.util.Locale.FRANCE);

View Full Code Here
   1: import java.net.URL;
   2: import java.util.Locale;
   3: 
   4:         ...
   5: 
   6:         assertEquals(enPath, f.findLocalizedPath(path, Locale.ENGLISH));
   7: 
   8:         ...
   9: 
  10:         assertEquals(frPath, f.findLocalizedPath(path, Locale.FRANCE));
  11:     }
  12:         ...
  13:         Resource base = new FileResource(path);
  14:         Resource localized = base.getLocalization(Locale.CHINA);

View Full Code Here
   1:       resources = ResourceBundle.getBundle("resources.Simple",
   2:                         Locale.getDefault());
   3:     } catch (MissingResourceException mre) {
   4:         ...
   5: 
   6:     co = ComponentOrientation.getOrientation(Locale.getDefault());
   7: 
   8:         ...
   9:     setLayout(new BoxLayout(this,BoxLayout.Y_AXIS));
  10:     String language = Locale.getDefault().getLanguage();
  11: 
  12:         ...
  13:         } else if (selected.equals(resources.getString("Chinese"))) {
  14:           Locale.setDefault(Locale.CHINA);

View Full Code Here
   1:             {
   2:                setCurrentLocale((Locale) localeCombo.getSelectedItem());
   3:             }
   4:         ...
   5: 
   6:    public void setCurrentLocale(Locale locale)
   7:    {
   8:         ...
   9: 
  10:    private Locale[] locales = { Locale.US, Locale.CHINA, Locale.GERMANY };
  11:    private Locale currentLocale;

View Full Code Here

CHINESE

public static final Locale CHINESE
Useful constant for language.
Usages and Demos :

View More Examples of CHINESE
   1: import java.util.List;
   2: import java.util.Locale;
   3: 
   4:         ...
   5: {
   6:     private static final Locale SPANISH = new Locale("es", "","");
   7:     private static final Locale CATALAN = new Locale("ca", "","");
   8:         ...
   9:         = Arrays.asList(new Locale[] {Locale.ENGLISH,
  10:                                       Locale.CHINESE,
  11:                                       Locale.GERMAN,

View Full Code Here
   1: import java.util.List;
   2: import java.util.Locale;
   3: import java.util.Map;
   4:         ...
   5: 
   6:     private static Locale systemDefaultLocale;
   7:     
   8:         ...
   9:         } else {
  10:             setLocale(new Locale(
  11:                     System.getProperty("user.language", "en"),
  12:         ...
  13:             new Locale("ru", ""),
  14:             Locale.CHINESE,

View Full Code Here
   1: import java.util.Hashtable;
   2: import java.util.Locale;
   3: import java.util.MissingResourceException;
   4:         ...
   5:     public String getMessage (
   6:     Locale        locale,
   7:     String        messageId
   8:         ...
   9:         if (localeName.equals ("zh"))
  10:         return Locale.CHINESE;

View Full Code Here
   1: import java.util.Hashtable;
   2: import java.util.Locale;
   3: import java.util.MissingResourceException;
   4:         ...
   5: 
   6:     public String getMessage(Locale locale,
   7:                              String messageId) {
   8:         ...
   9:             if (localeName.equals("zh"))
  10:                 return Locale.CHINESE;

View Full Code Here
   1: import java.util.Hashtable;
   2: import java.util.Locale;
   3: import java.util.MissingResourceException;
   4:         ...
   5:     public String getMessage (
   6:     Locale        locale,
   7:     String        messageId
   8:         ...
   9: 
  10:     if (locale == null)
  11:         locale = Locale.getDefault ();
  12:         ...
  13:         if (localeName.equals ("zh"))
  14:         return Locale.CHINESE;

View Full Code Here

ENGLISH

public static final Locale ENGLISH
Useful constant for language.
Usages and Demos :

View More Examples of ENGLISH
   1: import java.util.GregorianCalendar;
   2: import java.util.Locale;
   3: 
   4:         ...
   5: 
   6:     private Calendar myCalendar = GregorianCalendar.getInstance(Locale.ENGLISH);
   7: 
   8:         ...
   9:     private SimpleDateFormat myShortFormat = new SimpleDateFormat("EEE",
  10:             Locale.ENGLISH);

View Full Code Here
   1: import java.util.Iterator;
   2: import java.util.Locale;
   3: import java.util.ResourceBundle;
   4:         ...
   5: 
   6:     public Locale getLocale() {
   7:         ...
   8:         return Locale.ENGLISH;
   9:     }

View Full Code Here
   1: 
   2: import java.util.Locale;
   3: 
   4:         ...
   5: 
   6:     protected ExporterBase(Profile profile, Locale locale, IProfileLogger logger) {
   7:         super(locale, logger);
   8:         ...
   9:         return ProfilePanel.askForProfile(type, values, new Banner.BannerSpec(
  10:                 MyLocalizable.s(type, Locale.ENGLISH, ClassUtils
  11:                         .getShortClassName(type)), MyLocalizable.s(type,
  12:         ...
  13:                         Locale.ENGLISH, ClassUtils.getShortClassName(type)

View Full Code Here
   1: import java.io.IOException;
   2: import java.util.Locale;
   3: 
   4:         ...
   5: 
   6:     protected Locale language;
   7: 
   8:         ...
   9: 
  10:     public ImporterBase(Profile profile, Locale locale, IProfileLogger logger) {
  11:         super(locale, logger);
  12:         ...
  13:         return ProfilePanel.askForProfile(type, null, new Banner.BannerSpec(
  14:                 MyLocalizable.s(type, Locale.ENGLISH, ClassUtils

View Full Code Here
   1: 
   2: import java.util.Locale;
   3: import java.util.StringTokenizer;
   4:         ...
   5:     
   6:     public static Locale getDefaultLocale()
   7:     {
   8:         ...
   9:         return Locale.ENGLISH;
  10:     }
  11:         ...
  12: 
  13:     public static String convertLocaleToString(Locale locale)

View Full Code Here

FRANCE

public static final Locale FRANCE
Useful constant for country.
Usages and Demos :

View More Examples of FRANCE
   1:     Date today = new Date();
   2:     Locale[] locales = {Locale.US, Locale.UK,
   3:         ...
   4:                         Locale.GERMANY, Locale.FRANCE };  
   5: 
   6:     int[] styles = { DateFormat.FULL,DateFormat.LONG,
   7:                      DateFormat.MEDIUM,DateFormat.SHORT}; 

View Full Code Here
   1: 
   2: import java.util.Locale;
   3: 
   4:         ...
   5:     
   6:     private final Locale[] LOCALES = new Locale[] {Locale.FRANCE, Locale.US, new Locale("pt", "PT")};
   7: 
   8:         ...
   9:         super("impex.msproject.mpx.language", new String[] {
  10:                 Locale.FRANCE.getDisplayLanguage(GanttLanguage.getInstance().getLocale()), Locale.US.getDisplayLanguage(GanttLanguage.getInstance().getLocale()), new Locale("pt", "PT").getDisplayLanguage(GanttLanguage.getInstance().getLocale())                
  11:         });

View Full Code Here
   1: 
   2: import java.util.Locale;
   3: 
   4:         ...
   5:                 "overridden-in-base",
   6:                 Locale.FRENCH));
   7: 
   8:         ...
   9:                 "overridden-in-base",
  10:                 Locale.FRANCE));
  11:     }
  12:         ...
  13:                 "only-in-base",
  14:                 Locale.FRENCH));

View Full Code Here
   1: 
   2: import java.util.Locale;
   3: 
   4:         ...
   5: public class DayConverterTest extends TestCase {
   6:     private Locale defaultLocale;
   7: 
   8:         ...
   9:         super.setUp();
  10:         defaultLocale = Locale.getDefault();
  11:         Locale.setDefault(Locale.US);
  12:         ...
  13:         
  14:         Locale.setDefault(Locale.FRANCE);

View Full Code Here

FRENCH

public static final Locale FRENCH
Useful constant for language.
Usages and Demos :

View More Examples of FRENCH
   1: 
   2: import java.util.Locale;
   3: import java.util.Date;
   4:         ...
   5:     {
   6:         Locale locale = Locale.FRENCH;
   7:         Date date = new Date();
   8:         ...
   9: 
  10:         String now = DateFormat.getTimeInstance(DateFormat.DEFAULT, locale)
  11:             .format(date);

View Full Code Here
   1: 
   2: import java.util.Locale;
   3: 
   4:         ...
   5:     
   6:     protected Locale getLocale() {
   7:         ...
   8:         return Locale.FRENCH;
   9:     }

View Full Code Here
   1: 
   2: import java.util.Locale;
   3: 
   4:         ...
   5:                 "overridden-in-base",
   6:                 Locale.FRENCH));
   7: 
   8:         ...
   9:                 "overridden-in-base",
  10:                 Locale.FRANCE));
  11:     }
  12:         ...
  13:                 "only-in-base",
  14:                 Locale.FRENCH));

View Full Code Here
   1: import java.util.Calendar;
   2: import java.util.Locale;
   3: 
   4:         ...
   5:     static {
   6:         Locale.setDefault(Locale.FRENCH);
   7:     }
   8:         ...
   9:         String formatted = format.format(date);
  10:         assertEquals("Locale dependent conversions", "mar. d\u00E9c. 09 05:00:000 1980", formatted);
  11:         

View Full Code Here
   1: 
   2:    static void displayValue(Locale currentLocale, String key) {
   3: 
   4:         ...
   5:       System.out.println(
   6:            "Locale = " + currentLocale.toString() + ", " +
   7:            "key = " + key + ", " +
   8:         ...
   9: 
  10:    static void iterateKeys(Locale currentLocale) {
  11: 
  12:         ...
  13:       Locale[] supportedLocales = {
  14:          Locale.FRENCH,

View Full Code Here

GERMAN

public static final Locale GERMAN
Useful constant for language.
Usages and Demos :

View More Examples of GERMAN
   1: 
   2:    static void displayValue(Locale currentLocale, String key) {
   3: 
   4:         ...
   5:       System.out.println(
   6:            "Locale = " + currentLocale.toString() + ", " +
   7:            "key = " + key + ", " +
   8:         ...
   9: 
  10:    static void iterateKeys(Locale currentLocale) {
  11: 
  12:         ...
  13:          Locale.FRENCH,
  14:          Locale.GERMAN,

View Full Code Here
   1: import java.util.List;
   2: import java.util.Locale;
   3: 
   4:         ...
   5: {
   6:     private static final Locale SPANISH = new Locale("es", "","");
   7:     private static final Locale CATALAN = new Locale("ca", "","");
   8:         ...
   9:                                       Locale.CHINESE,
  10:                                       Locale.GERMAN,
  11:                                       Locale.JAPANESE,

View Full Code Here
   1: import java.util.List;
   2: import java.util.Locale;
   3: 
   4:         ...
   5:         
   6:         localeManager.addDefaultLocale(Locale.US.toString());
   7:         ...
   8:         localeManager.addDefaultLocale(Locale.UK.toString());
   9:         localeManager.addDefaultLocale(Locale.GERMANY.toString());
  10:         ...
  11:         localeManager.addDefaultLocale(Locale.ENGLISH.toString());
  12:         localeManager.addDefaultLocale(Locale.GERMAN.toString()); 

View Full Code Here
   1: 
   2: import java.util.Locale;
   3: 
   4:         ...
   5:         localePattern = "#.###";
   6:         testLocale    = Locale.GERMANY;
   7:         localeExpected = testNumber;
   8:         ...
   9:     public void testLongValidatorMethods() {
  10:         Locale locale     = Locale.GERMAN;
  11:         String pattern    = "0,00,00";
  12:         ...
  13:         assertEquals("validate(A) pattern", expected, LongValidator.getInstance().validate(patternVal, pattern));
  14:         assertEquals("validate(A) both",    expected, LongValidator.getInstance().validate(germanPatternVal, pattern, Locale.GERMAN));

View Full Code Here
   1: 
   2: import java.util.Locale;
   3: 
   4:         ...
   5:         localePattern = "#.###,#";
   6:         testLocale    = Locale.GERMANY;
   7:         localeExpected = testNumber;
   8:         ...
   9:     public void testDoubleValidatorMethods() {
  10:         Locale locale     = Locale.GERMAN;
  11:         String pattern    = "0,00,00";
  12:         ...
  13:         assertEquals("validate(A) pattern", expected, DoubleValidator.getInstance().validate(patternVal, pattern));
  14:         assertEquals("validate(A) both",    expected, DoubleValidator.getInstance().validate(germanPatternVal, pattern, Locale.GERMAN));

View Full Code Here

GERMANY

public static final Locale GERMANY
Useful constant for country.
Usages and Demos :

View More Examples of GERMANY
   1: import java.util.Locale;
   2: 
   3:         ...
   4:         showLocale();
   5:         Locale.setDefault(Locale.GERMANY);
   6:         showLocale();
   7:         ...
   8:     public static void showLocale(){
   9:         Locale loc = Locale.getDefault();
  10:         System.out.print(loc.getDisplayCountry()+", ");

View Full Code Here
   1:     Date today = new Date();
   2:     Locale[] locales = {Locale.US, Locale.UK,
   3:         ...
   4:                         Locale.GERMANY, Locale.FRANCE };  
   5: 
   6:     int[] styles = { DateFormat.FULL,DateFormat.LONG,
   7:                      DateFormat.MEDIUM,DateFormat.SHORT}; 

View Full Code Here
   1: import java.io.Serializable;
   2: import java.util.Locale;
   3: 
   4:         ...
   5:     private int     value3;
   6:     private Locale locale = Locale.GERMANY;
   7: 
   8:         ...
   9: 
  10:     public Locale getLocale()
  11:     {

View Full Code Here
   1: import java.io.Serializable;
   2: import java.util.Locale;
   3: 
   4:         ...
   5:     private int     value3;
   6:     private Locale locale = Locale.GERMANY;
   7: 
   8:         ...
   9: 
  10:     public Locale getLocale()
  11:     {

View Full Code Here
   1: import java.util.List;
   2: import java.util.Locale;
   3: 
   4:         ...
   5:         
   6:         localeManager.addDefaultLocale(Locale.US.toString());
   7:         ...
   8:         localeManager.addDefaultLocale(Locale.UK.toString());
   9:         ...
  10:         localeManager.addDefaultLocale(Locale.GERMANY.toString());

View Full Code Here

ITALIAN

public static final Locale ITALIAN
Useful constant for language.
Usages and Demos :

View More Examples of ITALIAN
   1:     Calendar now = Calendar.getInstance();
   2:     Locale locale = Locale.getDefault();
   3:     Map<String, Integer> names = now.getDisplayNames(
   4:         ...
   5:       Calendar.DAY_OF_WEEK, Calendar.LONG, locale);
   6:     System.out.println(names);
   7:     System.console().printf("%s%n", names.toString());
   8:     String name = now.getDisplayName(Calendar.DAY_OF_WEEK,

View Full Code Here
   1: import java.text.*;
   2: import java.util.Locale;
   3: import java.util.Calendar;
   4:         ...
   5:   protected static String defaultPattern = "EEE, dd MMM yyyy HH:mm:ss z";
   6:    protected static Locale defaultLocale = new Locale("en",Locale.ITALIAN.getCountry());
   7:    protected long me = 0;
   8: 
   9:    public Dates(Date d)

View Full Code Here
   1: import java.util.List;
   2: import java.util.Locale;
   3: import java.util.Map;
   4:         ...
   5: 
   6:     private static Locale systemDefaultLocale;
   7:     
   8:         ...
   9:         } else {
  10:             setLocale(new Locale(
  11:                     System.getProperty("user.language", "en"),
  12:         ...
  13:             Locale.GERMAN,
  14:             Locale.ITALIAN,

View Full Code Here
   1: import org.mortbay.jetty.servlet.HashSessionManager;
   2: import java.util.Locale;
   3: 
   4:         ...
   5:         ContextHandler context = new ContextHandler();
   6:         context.addLocaleEncoding(Locale.ENGLISH.toString(),"ISO-8859-1");
   7:         ...
   8:         context.addLocaleEncoding(Locale.ITALIAN.toString(),"ISO-8859-2");
   9:         request.setContext(context.getServletContext());
  10:         ...
  11: 
  12:         response.setLocale(java.util.Locale.ITALIAN);

View Full Code Here
   1: import java.util.Hashtable;
   2: import java.util.Locale;
   3: import java.util.MissingResourceException;
   4:         ...
   5:     public String getMessage (
   6:     Locale        locale,
   7:     String        messageId
   8:         ...
   9:         if (localeName.equals ("it"))
  10:         return Locale.ITALIAN;
  11:         if (localeName.equals ("ja"))

View Full Code Here

ITALY

public static final Locale ITALY
Useful constant for country.
Usages and Demos :

View More Examples of ITALY
   1:       if (argv[0].equalsIgnoreCase("canada"))
   2:         java.util.Locale.setDefault(java.util.Locale.CANADA);
   3:       if (argv[0].equalsIgnoreCase("canada_french"))
   4:         ...
   5:         java.util.Locale.setDefault(java.util.Locale.CANADA_FRENCH);
   6:       if (argv[0].equalsIgnoreCase("china"))
   7:         ...
   8:         java.util.Locale.setDefault(java.util.Locale.CHINA);
   9:       if (argv[0].equalsIgnoreCase("france"))
  10:         ...
  11:       if (argv[0].equalsIgnoreCase("italy"))
  12:         java.util.Locale.setDefault(java.util.Locale.ITALY);

View Full Code Here
   1:       resources = ResourceBundle.getBundle("resources.Simple",
   2:                         Locale.getDefault());
   3:     } catch (MissingResourceException mre) {
   4:         ...
   5: 
   6:     co = ComponentOrientation.getOrientation(Locale.getDefault());
   7: 
   8:         ...
   9:     setLayout(new BoxLayout(this,BoxLayout.Y_AXIS));
  10:     String language = Locale.getDefault().getLanguage();
  11: 
  12:         ...
  13:         } else if (selected.equals(resources.getString("Italian"))) {
  14:           Locale.setDefault(Locale.ITALY);

View Full Code Here
   1: import java.util.HashMap;
   2: import java.util.Locale;
   3: import java.util.Map;
   4:         ...
   5: 
   6:       setDefaultLocale(Locale.ENGLISH);
   7:         ...
   8:       mbean = new I18NStandardMBeanSupport.SubclassNameOnly(Locale.FRENCH);
   9:       info = mbean.getMBeanInfo();

View Full Code Here
   1: import java.util.List;
   2: import java.util.Locale;
   3: import java.util.MissingResourceException;
   4:         ...
   5: 
   6:     private Locale m_it = new Locale(Locale.ITALIAN.getLanguage(), Locale.ITALY.getCountry());
   7: 
   8:     private SimpleDateFormat m_formatter;

View Full Code Here

JAPAN

public static final Locale JAPAN
Useful constant for country.
Usages and Demos :

View More Examples of JAPAN
   1: import java.applet.*;
   2: import java.util.Locale;
   3: 
   4:         ...
   5: 
   6:     System.out.println(Locale.getDefault().getDisplayName());
   7:         ...
   8:     LocaleDisplayField.setText(Locale.getDefault().toString());
   9: 
  10:         ...
  11:     Locale.setDefault(Locale.JAPAN);

View Full Code Here
   1: 
   2: import java.util.Locale;
   3: 
   4:         ...
   5:         case 0 :
   6:             request.getSession().setAttribute(Globals.LOCALE_KEY,Locale.CHINA);
   7:             break;
   8:         ...
   9:         case 1:
  10:             request.getSession().setAttribute(Globals.LOCALE_KEY, Locale.JAPAN);
  11:             break;
  12:         ...
  13:         case 2:
  14:             request.getSession().setAttribute(Globals.LOCALE_KEY, Locale.ENGLISH);

View Full Code Here
   1:       if (argv[0].equalsIgnoreCase("canada"))
   2:         java.util.Locale.setDefault(java.util.Locale.CANADA);
   3:       if (argv[0].equalsIgnoreCase("canada_french"))
   4:         ...
   5:         java.util.Locale.setDefault(java.util.Locale.CANADA_FRENCH);
   6:       if (argv[0].equalsIgnoreCase("china"))
   7:         ...
   8:         java.util.Locale.setDefault(java.util.Locale.CHINA);
   9:       if (argv[0].equalsIgnoreCase("france"))
  10:         ...
  11:       if (argv[0].equalsIgnoreCase("japan"))
  12:         java.util.Locale.setDefault(java.util.Locale.JAPAN);

View Full Code Here
   1: 
   2: import java.util.Locale;
   3: import java.util.Vector;
   4:         ...
   5: import java.text.BreakIterator;
   6: import java.util.Locale;
   7: import java.io.ByteArrayOutputStream;
   8:         ...
   9: 
  10:     public static String formatCurrency(String amountString, Locale locale) {
  11:         try {
  12:         ...
  13:        if (language.equals("Japanese")) {
  14:         locale = Locale.JAPAN;

View Full Code Here
   1: import java.util.Hashtable;
   2: import java.util.Locale;
   3: import java.awt.AWTEvent;
   4:         ...
   5: 
   6:     public Locale[] getSupportLocales() {
   7:         ...
   8:     return new Locale[] {Locale.JAPAN};
   9:     }
  10:         ...
  11: 
  12:     public Locale[] getSupportLocales() {

View Full Code Here

JAPANESE

public static final Locale JAPANESE
Useful constant for language.
Usages and Demos :

View More Examples of JAPANESE
   1:     response.setContentType("text/html");
   2:     response.setLocale(Locale.JAPANESE);
   3:     PrintWriter out = response.getWriter();
   4:     out.println("<FONT SIZE=+2>");
   5:     out.println("\u4eca\u65e5\u306f\u4e16\u754c");

View Full Code Here
   1: import java.util.List;
   2: import java.util.Locale;
   3: 
   4:         ...
   5: {
   6:     private static final Locale SPANISH = new Locale("es", "","");
   7:     private static final Locale CATALAN = new Locale("ca", "","");
   8:         ...
   9:                                       Locale.GERMAN,
  10:                                       Locale.JAPANESE,
  11:                                       Locale.FRENCH,

View Full Code Here
   1: 
   2:       final Locale [] locales =
   3:       {
   4:         ...
   5:          Locale.ENGLISH,
   6:         ...
   7:          Locale.JAPANESE,
   8:          CalPage.JAPAN_IMP_ERA
   9:         ...
  10:       pnl = new JPanel ();
  11:       pnl.add (new JLabel ("Locale:"));

View Full Code Here
   1: import java.net.URL;
   2: import java.util.Locale;
   3: 
   4:         ...
   5: 
   6:         Resource l = r.forLocale(Locale.FRENCH);
   7: 
   8:         ...
   9: 
  10:         Resource l = r.forLocale(Locale.CANADA_FRENCH);
  11: 
  12:         ...
  13: 
  14:         Resource l = r.forLocale(Locale.JAPANESE);

View Full Code Here
   1: import java.util.Hashtable;
   2: import java.util.Locale;
   3: import java.util.MissingResourceException;
   4:         ...
   5:     public String getMessage (
   6:     Locale        locale,
   7:     String        messageId
   8:         ...
   9:         if (localeName.equals ("ja"))
  10:         return Locale.JAPANESE;
  11:         if (localeName.equals ("ko"))

View Full Code Here

KOREA

public static final Locale KOREA
Useful constant for country.
Usages and Demos :

View More Examples of KOREA
   1:       if (argv[0].equalsIgnoreCase("canada"))
   2:         java.util.Locale.setDefault(java.util.Locale.CANADA);
   3:       if (argv[0].equalsIgnoreCase("canada_french"))
   4:         ...
   5:         java.util.Locale.setDefault(java.util.Locale.CANADA_FRENCH);
   6:       if (argv[0].equalsIgnoreCase("china"))
   7:         ...
   8:         java.util.Locale.setDefault(java.util.Locale.CHINA);
   9:       if (argv[0].equalsIgnoreCase("france"))
  10:         ...
  11:       if (argv[0].equalsIgnoreCase("korea"))
  12:         java.util.Locale.setDefault(java.util.Locale.KOREA);

View Full Code Here

KOREAN

public static final Locale KOREAN
Useful constant for language.
Usages and Demos :

View More Examples of KOREAN
   1: import java.text.*;
   2: import java.util.Locale;
   3: 
   4:         ...
   5: 
   6:     BreakIterator ci = BreakIterator.getCharacterInstance(Locale.KOREAN);
   7:         ...
   8:     BreakIterator wi = BreakIterator.getWordInstance(Locale.KOREAN);

View Full Code Here
   1: 
   2: import java.util.Locale;
   3: 
   4:         ...
   5: 
   6:         tl.setLocale(Locale.KOREAN);
   7: 
   8:         ...
   9:         assertSame(Locale.KOREAN, tl.getLocale());
  10: 
  11:         ...
  12: 
  13:         Locale start = r.getLocale();

View Full Code Here
   1: import java.util.HashSet;
   2: import java.util.Locale;
   3: import java.util.Random;
   4:         ...
   5:     String sigmaFinalCased = sb.toString();
   6:     String tmp = sigmaFinalCased.toLowerCase(Locale.ENGLISH);
   7:     assert (tmp.charAt(5) == '\u03C2') : Integer.toHexString(tmp.charAt(5));
   8:         ...
   9:     String sigmaNotFinalCased = sb.toString();
  10:     tmp = sigmaNotFinalCased.toLowerCase(Locale.ENGLISH);
  11:     assert (tmp.charAt(5) == '\u03C3') : Integer.toHexString(tmp.charAt(5));
  12:         ...
  13:       Locale.GERMAN,
  14:       Locale.KOREAN,

View Full Code Here
   1: import java.util.Hashtable;
   2: import java.util.Locale;
   3: import java.util.MissingResourceException;
   4:         ...
   5:     public String getMessage (
   6:     Locale        locale,
   7:     String        messageId
   8:         ...
   9:         if (localeName.equals ("ko"))
  10:         return Locale.KOREAN;
  11:         if (localeName.equals ("zh"))

View Full Code Here
   1: import java.util.Hashtable;
   2: import java.util.Locale;
   3: import java.util.MissingResourceException;
   4:         ...
   5: 
   6:     public String getMessage(Locale locale,
   7:                              String messageId) {
   8:         ...
   9:             if (localeName.equals("ko"))
  10:                 return Locale.KOREAN;
  11:             if (localeName.equals("zh"))

View Full Code Here

PRC

public static final Locale PRC
Useful constant for country.
Usages and Demos :

View More Examples of PRC
   1:       if (argv[0].equalsIgnoreCase("canada"))
   2:         java.util.Locale.setDefault(java.util.Locale.CANADA);
   3:       if (argv[0].equalsIgnoreCase("canada_french"))
   4:         ...
   5:         java.util.Locale.setDefault(java.util.Locale.CANADA_FRENCH);
   6:       if (argv[0].equalsIgnoreCase("china"))
   7:         ...
   8:         java.util.Locale.setDefault(java.util.Locale.CHINA);
   9:       if (argv[0].equalsIgnoreCase("france"))
  10:         ...
  11:       if (argv[0].equalsIgnoreCase("prc"))
  12:         java.util.Locale.setDefault(java.util.Locale.PRC);

View Full Code Here
   1: import java.util.GregorianCalendar;
   2: import java.util.Locale;
   3: import java.util.TimeZone;
   4:         ...
   5: 
   6:     static Locale[] supportedLocales;
   7: 
   8:         ...
   9:     static void testLocaleMapping() {
  10:         Locale[] locales = Locale.getAvailableLocales();
  11:         int goodCountries = 0;
  12:         ...
  13:         testSymbol("EUR", Locale.GERMANY, "\u20AC");
  14:         testSymbol("USD", Locale.PRC, "USD");

View Full Code Here

SIMPLIFIED_CHINESE

public static final Locale SIMPLIFIED_CHINESE
Useful constant for language.
Usages and Demos :

View More Examples of SIMPLIFIED_CHINESE
   1: import java.util.HashMap;
   2: import java.util.Locale;
   3: import java.util.Map;
   4:         ...
   5:     predefinedLocaleMap_ = new HashMap(10) ;
   6:     predefinedLocaleMap_.put("us" , Locale.US) ;
   7:         ...
   8:     predefinedLocaleMap_.put("en" , Locale.ENGLISH) ;
   9:     predefinedLocaleMap_.put("fr" , Locale.FRANCE) ;
  10:         ...
  11:     predefinedLocaleMap_.put("zh" , Locale.SIMPLIFIED_CHINESE) ;

View Full Code Here
   1: import java.util.Hashtable;
   2: import java.util.Locale;
   3: import java.util.MissingResourceException;
   4:         ...
   5:     public String getMessage (
   6:     Locale        locale,
   7:     String        messageId
   8:         ...
   9:         if (localeName.equals ("zh_CN"))
  10:         return Locale.SIMPLIFIED_CHINESE;
  11:         if (localeName.equals ("zh_TW"))

View Full Code Here
   1: import java.util.Hashtable;
   2: import java.util.Locale;
   3: import java.util.MissingResourceException;
   4:         ...
   5: 
   6:     public String getMessage(Locale locale,
   7:                              String messageId) {
   8:         ...
   9:             if (localeName.equals("zh_CN"))
  10:                 return Locale.SIMPLIFIED_CHINESE;
  11:             if (localeName.equals("zh_TW"))

View Full Code Here
   1: import java.util.Hashtable;
   2: import java.util.Locale;
   3: import java.util.MissingResourceException;
   4:         ...
   5:     public String getMessage (
   6:     Locale        locale,
   7:     String        messageId
   8:         ...
   9: 
  10:     if (locale == null)
  11:         locale = Locale.getDefault ();
  12:         ...
  13:         if (localeName.equals ("zh_CN"))
  14:         return Locale.SIMPLIFIED_CHINESE;

View Full Code Here
   1: import java.nio.ByteBuffer;
   2: import java.util.Locale;
   3: 
   4:         ...
   5:   public static String getName(ByteBuffer nameTable,
   6:                                int name, Locale locale)
   7:   {
   8:         ...
   9:     case 19:
  10:       if (loc.equals(Locale.SIMPLIFIED_CHINESE))
  11:         code = 33;
  12:         ...
  13:     case 19: return Locale.TRADITIONAL_CHINESE;
  14:     case 33: return Locale.SIMPLIFIED_CHINESE;

View Full Code Here

TAIWAN

public static final Locale TAIWAN
Useful constant for country.
Usages and Demos :

View More Examples of TAIWAN
   1:       if (argv[0].equalsIgnoreCase("canada"))
   2:         java.util.Locale.setDefault(java.util.Locale.CANADA);
   3:       if (argv[0].equalsIgnoreCase("canada_french"))
   4:         ...
   5:         java.util.Locale.setDefault(java.util.Locale.CANADA_FRENCH);
   6:       if (argv[0].equalsIgnoreCase("china"))
   7:         ...
   8:         java.util.Locale.setDefault(java.util.Locale.CHINA);
   9:       if (argv[0].equalsIgnoreCase("france"))
  10:         ...
  11:       if (argv[0].equalsIgnoreCase("taiwan"))
  12:         java.util.Locale.setDefault(java.util.Locale.TAIWAN);

View Full Code Here
   1: import org.opensourcephysics.tools.ToolsRes;
   2: import java.util.Locale;
   3: 
   4:         ...
   5: 
   6:   public static Locale[] getDefaultLocales() {
   7:     return defaultLocales;
   8:         ...
   9:     });
  10:     ToolsRes.addPropertyChangeListener("locale", new PropertyChangeListener() {

View Full Code Here
   1:   protected JMenu languageMenu;
   2:   protected Locale[] locales;
   3:   protected JMenuItem[] languageItems;
   4:         ...
   5:     }
   6:     locales = new Locale[] {
   7:         ...
   8:                     Locale.ENGLISH,
   9:         ...
  10:             Locale.TAIWAN};

View Full Code Here

TRADITIONAL_CHINESE

public static final Locale TRADITIONAL_CHINESE
Useful constant for language.
Usages and Demos :

View More Examples of TRADITIONAL_CHINESE
   1: import java.util.Hashtable;
   2: import java.util.Locale;
   3: import java.util.MissingResourceException;
   4:         ...
   5:     public String getMessage (
   6:     Locale        locale,
   7:     String        messageId
   8:         ...
   9:         if (localeName.equals ("zh_TW"))
  10:         return Locale.TRADITIONAL_CHINESE;

View Full Code Here
   1: import java.util.Hashtable;
   2: import java.util.Locale;
   3: import java.util.MissingResourceException;
   4:         ...
   5: 
   6:     public String getMessage(Locale locale,
   7:                              String messageId) {
   8:         ...
   9:             if (localeName.equals("zh_TW"))
  10:                 return Locale.TRADITIONAL_CHINESE;

View Full Code Here
   1: import java.util.Hashtable;
   2: import java.util.Locale;
   3: import java.util.MissingResourceException;
   4:         ...
   5:     public String getMessage (
   6:     Locale        locale,
   7:     String        messageId
   8:         ...
   9: 
  10:     if (locale == null)
  11:         locale = Locale.getDefault ();
  12:         ...
  13:         if (localeName.equals ("zh_TW"))
  14:         return Locale.TRADITIONAL_CHINESE;

View Full Code Here
   1: import java.nio.ByteBuffer;
   2: import java.util.Locale;
   3: 
   4:         ...
   5:   public static String getName(ByteBuffer nameTable,
   6:                                int name, Locale locale)
   7:   {
   8:         ...
   9:     case 23: return Locale.KOREAN;
  10:     case 19: return Locale.TRADITIONAL_CHINESE;
  11:     case 33: return Locale.SIMPLIFIED_CHINESE;

View Full Code Here
   1:     private int manageRuleID = NOID;
   2:     private Locale prevLocale = null;
   3: 
   4:         ...
   5:             }
   6:             Locale[] localeList = null;
   7:             if (localeNameList != null) {
   8:         ...
   9:                 int max = localeNameList.length;
  10:                 localeList = new Locale[max];
  11:                 for (int i = 0; i < max; i++) {
  12:         ...
  13:         } else if (str.equals("zh_TW")) {
  14:         return Locale.TRADITIONAL_CHINESE;

View Full Code Here

UK

public static final Locale UK
Useful constant for country.
Usages and Demos :

View More Examples of UK
   1:     Date today = new Date();
   2:     Locale[] locales = {Locale.US, Locale.UK,
   3:         ...
   4:                         Locale.GERMANY, Locale.FRANCE };  
   5: 
   6:     int[] styles = { DateFormat.FULL,DateFormat.LONG,
   7:                      DateFormat.MEDIUM,DateFormat.SHORT}; 

View Full Code Here
   1: 
   2: import java.util.Locale;
   3: import javax.swing.JComboBox;
   4:         ...
   5:         JPanel contentPane = new JPanel();
   6:         Locale[] locales = new Locale[]{Locale.GERMAN, Locale.US, Locale.UK, new Locale("es")};
   7:         contentPane.add(comboBox);
   8:         setContentPane(contentPane);
   9:     }

View Full Code Here
   1: import java.util.List;
   2: import java.util.Locale;
   3: 
   4:         ...
   5:         
   6:         localeManager.addDefaultLocale(Locale.US.toString());
   7:         ...
   8:         localeManager.addDefaultLocale(Locale.UK.toString());
   9:         ...
  10:         localeManager.addDefaultLocale(Locale.GERMANY.toString());

View Full Code Here
   1:       if (argv[0].equalsIgnoreCase("canada"))
   2:         java.util.Locale.setDefault(java.util.Locale.CANADA);
   3:       if (argv[0].equalsIgnoreCase("canada_french"))
   4:         ...
   5:         java.util.Locale.setDefault(java.util.Locale.CANADA_FRENCH);
   6:       if (argv[0].equalsIgnoreCase("china"))
   7:         ...
   8:         java.util.Locale.setDefault(java.util.Locale.CHINA);
   9:       if (argv[0].equalsIgnoreCase("france"))
  10:         ...
  11:       if (argv[0].equalsIgnoreCase("uk"))
  12:         java.util.Locale.setDefault(java.util.Locale.UK);

View Full Code Here
   1: 
   2: import java.util.Locale;
   3: import java.math.BigDecimal;
   4:         ...
   5:     public void testValid() {
   6:         Locale origDefault = Locale.getDefault();
   7:         ...
   8:         Locale.setDefault(Locale.UK);
   9: 
  10:         ...
  11: 
  12:         assertEquals("UK locale",      expected, validator.validate("12%",   Locale.UK));

View Full Code Here

US

public static final Locale US
Useful constant for country.
Usages and Demos :

View More Examples of US
   1: package com.sun.speech.freetts.en.us.cmu_time_awb;
   2: 
   3:         ...
   4: import com.sun.speech.freetts.en.us.CMUClusterUnitVoice;
   5:         ...
   6: import com.sun.speech.freetts.en.us.CMULexicon;
   7: import com.sun.speech.freetts.VoiceDirectory;
   8:         ...
   9: import com.sun.speech.freetts.Age;
  10: import java.util.Locale;

View Full Code Here
   1: package com.sun.speech.freetts.en.us.cmu_us_kal;
   2: 
   3:         ...
   4: import com.sun.speech.freetts.en.us.CMUDiphoneVoice;
   5:         ...
   6: import com.sun.speech.freetts.en.us.CMULexicon;
   7: import com.sun.speech.freetts.VoiceDirectory;
   8:         ...
   9: import com.sun.speech.freetts.Age;
  10: import java.util.Locale;

View Full Code Here
   1: 
   2: import java.util.Locale;
   3: 
   4:         ...
   5:     
   6:     private final Locale[] LOCALES = new Locale[] {Locale.FRANCE, Locale.US, new Locale("pt", "PT")};
   7: 
   8:         ...
   9:         super("impex.msproject.mpx.language", new String[] {
  10:                 Locale.FRANCE.getDisplayLanguage(GanttLanguage.getInstance().getLocale()), Locale.US.getDisplayLanguage(GanttLanguage.getInstance().getLocale()), new Locale("pt", "PT").getDisplayLanguage(GanttLanguage.getInstance().getLocale())                
  11:         });

View Full Code Here
   1:       df = DateFormat.getDateTimeInstance (DateFormat.SHORT, DateFormat.SHORT,
   2:                                            Locale.US);
   3: 
   4:       Object [][] rows =
   5:       {

View Full Code Here
   1: package de.dfki.lt.freetts.en.us;
   2: 
   3:         ...
   4: import com.sun.speech.freetts.en.us.CMULexicon;
   5: import com.sun.speech.freetts.VoiceDirectory;
   6:         ...
   7: import java.util.ArrayList;
   8: import java.util.Locale;
   9: 
  10:         ...
  11:                  "MBROLA Voice us1",
  12:                  Locale.US, "general", "mbrola", lexicon);

View Full Code Here

Constructor Details

Locale

public Locale(String language)
Construct a locale from a language code. NOTE: ISO 639 is not a stable standard; some of the language codes it defines (specifically iw, ji, and in) have changed. This constructor accepts both the old codes (iw, ji, and in) and the new codes (he, yi, and id), but all other API on Locale will return only the OLD codes.
Parameters:
language - lowercase two-letter ISO-639 code.
Throws:
NullPointerException - thrown if argument is null.
Since:
1.4
Usages and Demos :

View More Examples of Locale(String language)
   1:         else if (lang != null)
   2:             return new Locale(lang);
   3:         else
   4:         ...
   5:             return new Locale("");
   6:     }
   7: 
   8:     public static String getString(Locale locale) {

View Full Code Here
   1: 
   2:         arb.addBundle("bundle1", new Locale(""), buildBundle(bundle1En));
   3:         ...
   4:         arb.addBundle("bundle1", new Locale("nl"), buildBundle(bundle1Nl));
   5:         arb.addBundle("bundle1", new Locale("nl", "BE"), buildBundle(bundle1NlBe));
   6:         ...
   7:         arb.addBundle("bundle2", new Locale(""), buildBundle(bundle2En));
   8:         arb.addBundle("bundle2", new Locale("nl"), buildBundle(bundle2Nl));

View Full Code Here
   1:         } else if (suffix1 != null) {
   2:             locale = new Locale(suffix1[1]);
   3:             baseName = suffix1[0];
   4:         ...
   5:         } else {
   6:             locale = new Locale("");
   7:             baseName = fileName;
   8:         }

View Full Code Here
   1:         else if (lang != null)
   2:             return new Locale(lang);
   3:         else
   4:         ...
   5:             return new Locale("");
   6:     }
   7: 
   8:     public static String getString(Locale locale) {

View Full Code Here
   1:         super(locales);
   2:         ((DefaultComboBoxModel) getModel()).insertElementAt(new Locale(" "), 0);
   3:         this.factory = new DictionaryFactory(url);
   4:         ...
   5:             {
   6:                 Locale loc = new Locale(locale.getLanguage());
   7:                 getDictionary(loc);
   8:             } else
   9:             {

View Full Code Here

Locale

public Locale(String language,
              String country)
Construct a locale from language, country. NOTE: ISO 639 is not a stable standard; some of the language codes it defines (specifically iw, ji, and in) have changed. This constructor accepts both the old codes (iw, ji, and in) and the new codes (he, yi, and id), but all other API on Locale will return only the OLD codes.
Parameters:
language - lowercase two-letter ISO-639 code.
country - uppercase two-letter ISO-3166 code.
Throws:
NullPointerException - thrown if either argument is null.
Usages and Demos :

View More Examples of Locale(String language,String country)
   1:                 String iso = codes[i];
   2:                 String name = new Locale("", codes[i]).getDisplayCountry();
   3:                 items[i] = new SelectItem(iso, name);
   4:             }
   5:             return items;

View Full Code Here
   1:             protected String getCellText(Object value) {
   2:                 return new Locale("", (String) value).getDisplayCountry();
   3:             }
   4:         });
   5:         return box;

View Full Code Here
   1: 
   2:     public static final Locale ENGLISH = new Locale("", "");
   3: 
   4:         ...
   5:     public static final Locale SPANISH = new Locale("es", "ES");
   6: 
   7:         ...
   8:     public static final Locale GERMAN = new Locale("de", "DE");

View Full Code Here

Locale

public Locale(String language,
              String country,
              String variant)
Construct a locale from language, country, variant. NOTE: ISO 639 is not a stable standard; some of the language codes it defines (specifically iw, ji, and in) have changed. This constructor accepts both the old codes (iw, ji, and in) and the new codes (he, yi, and id), but all other API on Locale will return only the OLD codes.
Parameters:
language - lowercase two-letter ISO-639 code.
country - uppercase two-letter ISO-3166 code.
variant - vendor and browser specific code. See class description.
Throws:
NullPointerException - thrown if any argument is null.
Usages and Demos :

View More Examples of Locale(String language,String country,String variant)
   1: {
   2:     private static final Locale SPANISH = new Locale("es", "","");
   3:         ...
   4:     private static final Locale CATALAN = new Locale("ca", "","");
   5: 
   6:     private static final List AVAILABLE_LOCALES
   7:         = Arrays.asList(new Locale[] {Locale.ENGLISH,

View Full Code Here
   1:     public Locale getDefaultLanguageOf(String tierName, String fileName) {
   2:         return new Locale("US", "en", "");
   3:     }
   4: 
   5:     public abstract String getParentNameOf(String tierName, String fileName);

View Full Code Here
   1:       CLIManFileFinder c = new CLIManFileFinder();
   2:       Locale l = new Locale("en", "UK", "v1");
   3:       Iterator it = c.getPossibleLocations("command", l);
   4:         ...
   5:       CLIManFileFinder c = new CLIManFileFinder();
   6:       Locale l = new Locale("en", "UK", "v1");
   7:       Iterator it = c.getPossibleLocations("command", l);
   8:         ...
   9:       CLIManFileFinder c = new CLIManFileFinder();
  10:       Locale l = new Locale("en", "UK", "v1");
  11:       Iterator it = c.getPossibleLocations("command", l);

View Full Code Here
   1:           ResourceBundle.getBundle("gnu.java.locale.LocaleInformation",
   2:                        new Locale("","","")
   3:                        ).getString(property);
   4:         ...
   5: 
   6:         result[i] = new Locale(language, region, variant);
   7:       }
   8:     return result;
   9:   }

View Full Code Here

Method Details

clone

public Object clone()
Overrides Cloneable
Overrides:
clone in interface Object

equals

public boolean equals(Object obj)
Returns true if this Locale is equal to another object. A Locale is deemed equal to another Locale with identical language, country, and variant, and unequal to all other objects.
Overrides:
equals in interface Object
Returns:
true if this Locale is equal to the specified object.
Usages and Demos :

View More Examples of equals(Object obj)
   1: import java.util.ArrayList;
   2: import java.util.Locale;
   3: import java.util.ResourceBundle;
   4:         ...
   5:         final ArrayList locList = new ArrayList();
   6:         Locale defaultLocale = CustomizedLocale.get();
   7: 
   8:         ...
   9:             String code = st.nextToken();
  10:             Locale l = new Locale(code);
  11:             CustomizedLocale.set(l);
  12:         ...
  13:             ResourceBundle r = ResourceFinder.get(Installer.class);
  14:             if ((defaultLocale.getVariant().equals("") && defaultLocale.getCountry().equals("") && defaultLocale.getLanguage().equals(l.getLanguage()))

View Full Code Here
   1: import java.util.HashMap;
   2: import java.util.Locale;
   3: import java.util.Enumeration;
   4:         ...
   5:             for (Iterator it = _locators.iterator(); it.hasNext();)
   6:                 if (it.next().equals(locator)) {
   7:                     log.warning("Ignored because of replication: "+locator);
   8:         ...
   9: 
  10:     protected String getProperty(Locale locale, String key) {
  11:         String label = (String)getLabels(locale).get(key);
  12:         ...
  13:         }
  14:         return "en".equals(lang) ? null: (String)getLabels(Locale.ENGLISH).get(key);

View Full Code Here
   1: import java.text.AttributedString;
   2: import java.util.Locale;
   3: 
   4:         ...
   5:   private InputMethodContext inputMethodContext;
   6:   private Locale locale;
   7: 
   8:         ...
   9:   public boolean setLocale(Locale locale) {
  10:     return (locale.equals(this.locale));
  11:   }

View Full Code Here
   1: import java.util.HashMap;
   2: import java.util.Locale;
   3: import java.util.Map;
   4:         ...
   5:         private int m_hashcode;
   6:         private Locale m_locale;
   7: 
   8:         ...
   9: 
  10:         BundleKey(String s, Locale l) {
  11: 
  12:         ...
  13:             BundleKey key = (BundleKey)o;
  14:             return m_hashcode == key.m_hashcode && m_baseName.equals(key.m_baseName) && m_locale.equals(key.m_locale);

View Full Code Here
   1: import java.util.HashMap;
   2: import java.util.Locale;
   3: import java.util.Map;
   4:         ...
   5: 
   6:         View view = vr.resolveViewName("example1", Locale.getDefault());
   7:         assertEquals("Correct view class", InternalResourceView.class, view.getClass());
   8:         ...
   9: 
  10:         view = vr.resolveViewName("example2", Locale.getDefault());
  11:         assertEquals("Correct view class", JstlView.class, view.getClass());
  12:         ...
  13:         view.render(model, request, response);
  14:         assertTrue("Correct tb attribute", tb.equals(request.getAttribute("tb")));

View Full Code Here

getAvailableLocales

public static Locale[] getAvailableLocales()
Returns an array of all installed locales. The array returned must contain at least a Locale instance equal to Locale.US.
Returns:
An array of installed locales.
Usages and Demos :

View More Examples of getAvailableLocales()
   1: import java.util.Locale;
   2: 
   3:         ...
   4:     public static void main(String[] args) {
   5:         Locale[] ll = Locale.getAvailableLocales();
   6:         for (int i=0; i<ll.length; i++)
   7:             System.out.println(ll[i]);
   8:     }

View Full Code Here
   1: public class TimeBean {
   2:   private Locale[] allLocale = Locale.getAvailableLocales();
   3:   private String[] allTimeZone = TimeZone.getAvailableIDs();
   4:         ...
   5:  
   6:   public Locale[] getAllLocale() {
   7:     return allLocale;
   8:   }

View Full Code Here
   1:     if (e.getSource() == jbtLocale) {
   2:       Locale[] availableLocales = Locale.getAvailableLocales();
   3:       jtaDisplay.setText(null);
   4:       for (int i=0; i<availableLocales.length; i++) {
   5:         jtaDisplay.append(availableLocales[i].getDisplayName() + " "

View Full Code Here
   1: 
   2:       final Locale [] locales = Locale.getAvailableLocales();
   3: 
   4:         ...
   5:             if (column == 0)
   6:                 return "Locale";
   7:             else
   8:             if (column == 1)
   9:                 return "Currency Code";

View Full Code Here
   1:   
   2:   private Locale[] locales = Locale.getAvailableLocales();
   3:   
   4:         ...
   5:   
   6:   public Locale[] getLocales() {
   7:     return locales;
   8:   }
   9:   

View Full Code Here

getCountry

public String getCountry()
Returns the country/region code for this locale, which will either be the empty string or an uppercase ISO 3166 2-letter code.
See Also:
getDisplayCountry
Usages and Demos :

View More Examples of getCountry()
   1: 
   2: import java.util.Locale;
   3: 
   4:         ...
   5: 
   6:     public static Locale getLocale(String localeString) {
   7:         int separatorIndex = localeString.indexOf("_");
   8:         ...
   9:         String language = localeString.substring(separatorIndex + 1, localeString.length());
  10:         return new Locale(language, country);
  11:     }
  12:         ...
  13:     public static String getLocaleString(Locale locale) {
  14:         return locale.getCountry() + "_" + locale.getLanguage();

View Full Code Here
   1: 
   2: import java.util.Locale;
   3: import java.util.MissingResourceException;
   4:         ...
   5: public class SearchLocale {
   6:     private static Locale locale;
   7:     private static ResourceBundle resourcebundle;
   8:         ...
   9:         if ((locale != null) &&
  10:                 locale.getCountry().equals(locale_in.getCountry())) {
  11:             return;

View Full Code Here
   1: 
   2: import java.util.Locale;
   3: import java.util.StringTokenizer;
   4:         ...
   5:          
   6:         Locale existingLocale = LanguageUtil.getViewLocale(request);
   7:         ...
   8:         Locale newLocale = new Locale(newLang, existingLocale.getCountry());

View Full Code Here
   1: 
   2: import java.util.Locale;
   3: 
   4:         ...
   5:             LocaleTokenizer tok = new LocaleTokenizer(HEADER);
   6:             Locale locale = (Locale) tok.next();
   7:             assertEquals("Either wrong language or order parsing: " + locale,
   8:         ...
   9:             assertEquals("Either wrong country or order parsing: " + locale,
  10:                          locale.getCountry(), "TW");
  11:         }

View Full Code Here
   1: import java.util.Enumeration;
   2: import java.util.Locale;
   3: import java.util.PropertyResourceBundle;
   4:         ...
   5:   public LocalizationContext getBundle(String name, String cacheKey,
   6:                                        Enumeration<Locale> locales)
   7:   {
   8:         ...
   9:     while (locales.hasMoreElements()) {
  10:       Locale locale = locales.nextElement();
  11: 
  12:         ...
  13:                        locale.getLanguage() + '_' +
  14:                        locale.getCountry() + '_' +

View Full Code Here

getDefault

public static Locale getDefault()
Gets the current value of the default locale for this instance of the Java Virtual Machine.

The Java Virtual Machine sets the default locale during startup based on the host environment. It is used by many locale-sensitive methods if no locale is explicitly specified. It can be changed using the setDefault method.

Returns:
the default locale for this instance of the Java Virtual Machine
Usages and Demos :

View More Examples of getDefault()
   1: 
   2: import java.util.Locale;
   3: 
   4:         ...
   5: 
   6:     public NoSuchMessageException(String code, Locale locale) {
   7:         super("No message found under code '" + code + "' for locale '" + locale + "'.");
   8:         ...
   9:     public NoSuchMessageException(String code) {
  10:         super("No message found under code '" + code + "' for locale '" + Locale.getDefault() + "'.");
  11:     }

View Full Code Here
   1: 
   2: import java.util.Locale;
   3: import java.util.ResourceBundle;
   4:         ...
   5:       textResources = ResourceBundle.getBundle("FooBarTextElements",
   6:           Locale.getDefault());
   7:       System.out.println(textResources.getString("CompanyName"));
   8:         ...
   9:             "com.foocompany.resources.FooBarTextElements",
  10:             Locale.getDefault());
  11:       System.out.println(textResources.getString("CompanyName"));

View Full Code Here
   1: 
   2: import java.util.Locale;
   3: import java.util.MissingResourceException;
   4:         ...
   5:             mResources = ResourceBundle.getBundle("phex.resources.phex",
   6:                                                  Locale.getDefault());
   7:         }
   8:         catch (MissingResourceException mre)
   9:         {

View Full Code Here
   1: 
   2: import java.util.Locale;
   3: 
   4:         ...
   5:     
   6:     public static Locale get()
   7:     {
   8:         ...
   9:         Locale locale = (Locale)currentLocale.get();
  10:         ...
  11:         return locale != null ? locale : Locale.getDefault();

View Full Code Here
   1:             "com.sun.dhcpmgr.bridge.ResourceBundle",
   2:             Locale.getDefault());
   3:         }
   4:         msg = bundle.getString(key);
   5:     } catch (Throwable e) {

View Full Code Here

getDisplayCountry

public final String getDisplayCountry()
Returns a name for the locale's country that is appropriate for display to the user. If possible, the name returned will be localized for the default locale. For example, if the locale is fr_FR and the default locale is en_US, getDisplayCountry() will return "France"; if the locale is en_US and the default locale is fr_FR, getDisplayLanguage() will return "Etats-Unis". If the name returned cannot be localized for the default locale, (say, we don't have a Japanese name for Croatia), this function falls back on the English name, and uses the ISO code as a last-resort value. If the locale doesn't specify a country, this function returns the empty string.
Usages and Demos :

View More Examples of getDisplayCountry()
   1: import java.util.Enumeration;
   2: import java.util.Locale;
   3: 
   4:         ...
   5:      Enumeration enum = request.getLocales();
   6:      Locale preferred = request.getLocale();
   7:      String prefDisplay = "";
   8:         ...
   9:      java.io.PrintWriter out = response.getWriter();
  10:      out.println("<html><head><title>Locale Display</title></head><body>");
  11:       
  12:         ...
  13:      if (preferred != null)
  14:      out.println( preferred.getDisplayCountry() );

View Full Code Here
   1: 
   2: import java.util.Locale;
   3: import java.util.MissingResourceException;
   4:         ...
   5: public class SearchLocale {
   6:     private static Locale locale;
   7:     private static ResourceBundle resourcebundle;
   8:         ...
   9:                 System.out.println("Warning: no localization for " + str +
  10:                     " found in language " + locale.getDisplayCountry());
  11:             } catch (Exception ex) {

View Full Code Here
   1: 
   2: import java.util.Locale;
   3: 
   4:         ...
   5: 
   6:         final Locale[] locales = MessageText.getLocales();
   7: 
   8:         ...
   9:         for (int i = 0; i < locales.length; i++) {
  10:             Locale locale = locales[i];
  11: 
  12:         ...
  13:         sName1 = locale.getDisplayCountry(locale);
  14:         sName2 = locale.getDisplayCountry();

View Full Code Here
   1: import java.util.GregorianCalendar;
   2: import java.util.Locale;
   3: import java.util.TimeZone;
   4:         ...
   5: 
   6:     static Locale[] supportedLocales;
   7: 
   8:         ...
   9:     static void testLocaleMapping() {
  10:         Locale[] locales = Locale.getAvailableLocales();
  11:         int goodCountries = 0;
  12:         ...
  13:             throw new RuntimeException("Wrong currency for " +
  14:                     locale.getDisplayCountry() +

View Full Code Here
   1: {
   2:     static Locale locale = null;
   3: 
   4:         ...
   5:     {
   6:         locale = Locale.getDefault();
   7: 
   8:         ...
   9:             
  10:         CBUtility.log("Using Locale: "+locale.getDisplayName()  + " for " + locale.getDisplayCountry(), 4);
  11:         CBUtility.log("language, localized for default locale is: " + def.getDisplayLanguage( locale ), 4);

View Full Code Here

getDisplayCountry

public String getDisplayCountry(Locale inLocale)
Returns a name for the locale's country that is appropriate for display to the user. If possible, the name returned will be localized according to inLocale. For example, if the locale is fr_FR and inLocale is en_US, getDisplayCountry() will return "France"; if the locale is en_US and inLocale is fr_FR, getDisplayLanguage() will return "Etats-Unis". If the name returned cannot be localized according to inLocale. (say, we don't have a Japanese name for Croatia), this function falls back on the default locale, on the English name, and finally on the ISO code as a last-resort value. If the locale doesn't specify a country, this function returns the empty string.
Usages and Demos :

View More Examples of getDisplayCountry(Locale inLocale)
   1: 
   2: import java.util.Locale;
   3: 
   4:         ...
   5: 
   6:         final Locale[] locales = MessageText.getLocales();
   7: 
   8:         ...
   9:         for (int i = 0; i < locales.length; i++) {
  10:             Locale locale = locales[i];
  11: 
  12:         ...
  13: 
  14:         sName1 = locale.getDisplayCountry(locale);

View Full Code Here

getDisplayLanguage

public final String getDisplayLanguage()
Returns a name for the locale's language that is appropriate for display to the user. If possible, the name returned will be localized for the default locale. For example, if the locale is fr_FR and the default locale is en_US, getDisplayLanguage() will return "French"; if the locale is en_US and the default locale is fr_FR, getDisplayLanguage() will return "anglais". If the name returned cannot be localized for the default locale, (say, we don't have a Japanese name for Croatian), this function falls back on the English name, and uses the ISO code as a last-resort value. If the locale doesn't specify a language, this function returns the empty string.
Usages and Demos :

View More Examples of getDisplayLanguage()
   1: import java.util.Enumeration;
   2: import java.util.Locale;
   3: 
   4:         ...
   5:      Enumeration enum = request.getLocales();
   6:      Locale preferred = request.getLocale();
   7:      String prefDisplay = "";
   8:         ...
   9:      java.io.PrintWriter out = response.getWriter();
  10:      out.println("<html><head><title>Locale Display</title></head><body>");
  11:       
  12:         ...
  13:      if (preferred != null)
  14:      out.println( preferred.getDisplayLanguage() );

View Full Code Here
   1: 
   2: import java.util.Locale;
   3: import java.util.MissingResourceException;
   4:         ...
   5: public class SearchLocale {
   6:     private static Locale locale;
   7:     private static ResourceBundle resourcebundle;
   8:         ...
   9:             System.out.println("WARNING: no language resources for " +
  10:                 locale.getDisplayLanguage());
  11:         }

View Full Code Here
   1: import java.util.List;
   2: import java.util.Locale;
   3: import javax.swing.Icon;
   4:         ...
   5:             languageInfo = "";
   6:             Locale locale;
   7:             String langs[] = language.split(",");
   8:         ...
   9:                     languageInfo += ", ";
  10:                 languageInfo += locale.getDisplayLanguage();
  11:             }

View Full Code Here
   1: 
   2: import java.util.Locale;
   3: 
   4:         ...
   5: 
   6:     public Locale getLocale()
   7:     {
   8:         ...
   9:     {
  10:         Locale locale = getLocale();
  11:         ...
  12:         return locale.getDisplayLanguage(); 

View Full Code Here
   1: 
   2: import java.util.Locale;
   3: 
   4:         ...
   5: 
   6:         final Locale[] locales = MessageText.getLocales();
   7: 
   8:         ...
   9:         for (int i = 0; i < locales.length; i++) {
  10:             Locale locale = locales[i];
  11: 
  12:         ...
  13:         String sName1 = locale.getDisplayLanguage(locale);
  14:         String sName2 = locale.getDisplayLanguage();

View Full Code Here

getDisplayLanguage

public String getDisplayLanguage(Locale inLocale)
Returns a name for the locale's language that is appropriate for display to the user. If possible, the name returned will be localized according to inLocale. For example, if the locale is fr_FR and inLocale is en_US, getDisplayLanguage() will return "French"; if the locale is en_US and inLocale is fr_FR, getDisplayLanguage() will return "anglais". If the name returned cannot be localized according to inLocale, (say, we don't have a Japanese name for Croatian), this function falls back on the default locale, on the English name, and finally on the ISO code as a last-resort value. If the locale doesn't specify a language, this function returns the empty string.
Usages and Demos :

View More Examples of getDisplayLanguage(Locale inLocale)
   1: 
   2: import java.util.Locale;
   3: 
   4:         ...
   5: 
   6:     public Locale getLocale()
   7:     {
   8:         ...
   9:     {
  10:         Locale locale = getLocale();
  11:         return locale.getDisplayLanguage(); 
  12:         ...
  13:         Locale locale = getLocale();
  14:         return locale.getDisplayLanguage(locale); 

View Full Code Here
   1: 
   2: import java.util.Locale;
   3: 
   4:         ...
   5: 
   6:         final Locale[] locales = MessageText.getLocales();
   7: 
   8:         ...
   9:         for (int i = 0; i < locales.length; i++) {
  10:             Locale locale = locales[i];
  11: 
  12:         ...
  13: 
  14:         String sName1 = locale.getDisplayLanguage(locale);

View Full Code Here
   1: import java.util.HashMap;
   2: import java.util.Locale;
   3: 
   4:         ...
   5:         
   6:         Locale locale = Localizer.getUsedLocale();
   7:         languageList.setSelectedValue( locale, true );
   8:         ...
   9:                 Locale locale = (Locale)value;
  10:                 String text = locale.getDisplayLanguage(locale);
  11:                 String variant = locale.getDisplayVariant( locale );

View Full Code Here
   1:         if(lang == null) {
   2:             Locale locale = Locale.getDefault();
   3:         ...
   4:             lang = (NSISLanguage)mLanguageMap.get(locale.getDisplayLanguage(Locale.US));
   5:             if(lang == null) {
   6:         ...
   7:                 lang = (NSISLanguage)mLanguageMap.get(mLocaleLanguageMap.get(locale.toString()));
   8:                 if(lang == null) {

View Full Code Here
   1: import java.util.Hashtable;
   2: import java.util.Locale;
   3: import java.util.jar.JarEntry;
   4:         ...
   5:       
   6:       String defLang = Locale.getDefault().getLanguage();
   7:       ImageIcon defImage = null;
   8:         ...
   9:                                     }
  10:                                 Locale locale = new Locale(code, country);
  11:                                 if( availableLocales!=null && availableLocales.containsKey(locale))
  12:         ...
  13:                                 {
  14:                                     String language = locale.getDisplayLanguage(locale);

View Full Code Here

getDisplayName

public final String getDisplayName()
Returns a name for the locale that is appropriate for display to the user. This will be the values returned by getDisplayLanguage(), getDisplayCountry(), and getDisplayVariant() assembled into a single string. The display name will have one of the following forms:

language (country, variant)

language (country)

language (variant)

country (variant)

language

country

variant

depending on which fields are specified in the locale. If the language, country, and variant fields are all empty, this function returns the empty string.
Usages and Demos :

View More Examples of getDisplayName()
   1: import java.util.Calendar;
   2: import java.util.Locale;
   3: 
   4:         ...
   5: public class LocaleEditor extends java.beans.PropertyEditorSupport {
   6:     private Locale[] locales;
   7:     private String[] localeStrings;
   8:         ...
   9:     private Locale locale;
  10:     private int length;
  11:         ...
  12:         for (int i = 0; i < length; i++)
  13:             localeStrings[i] = locales[i].getDisplayName();

View Full Code Here
   1: 
   2:   protected final static Locale[] availableLocales;
   3: 
   4:         ...
   5:   static {
   6:     availableLocales = Locale.getAvailableLocales();
   7:   }
   8:         ...
   9:   public final static String[] columnHeaders = 
  10:         {"Locale", "Numeric", "Currency", "Percent"};
  11: 
  12:         ...
  13:     Locale locale = Locale.getDefault();
  14:     TitledBorder tb = new TitledBorder(bb, locale.getDisplayName());

View Full Code Here
   1: 
   2:   protected final static Locale[] availableLocales;
   3: 
   4:         ...
   5:   static {
   6:     availableLocales = Locale.getAvailableLocales();
   7:   }
   8:         ...
   9:   public final static String[] columnHeaders = 
  10:                {"Locale", "Short", "Medium", "Long", "Full"};
  11: 
  12:         ...
  13:     Locale locale = Locale.getDefault();
  14:     TitledBorder tb = new TitledBorder(bb, locale.getDisplayName());

View Full Code Here
   1: 
   2:   protected final static Locale[] availableLocales;
   3: 
   4:         ...
   5:   static {availableLocales = Locale.getAvailableLocales();}
   6: 
   7:         ...
   8:   public final static String[] columnHeaders = 
   9:       {"Locale", "Short", "Medium", "Long", "Full"};
  10: 
  11:         ...
  12:     Locale locale = Locale.getDefault();
  13:     TitledBorder tb = new TitledBorder(bb, locale.getDisplayName());

View Full Code Here
   1: import java.util.Enumeration;
   2: import java.util.Locale;
   3: import java.util.Properties;
   4:         ...
   5:                     JLabel label = new JLabel();
   6:                     Locale locale = (Locale) value;
   7:         ...
   8:                     label.setText(locale.getDisplayName());

View Full Code Here

getDisplayName

public String getDisplayName(Locale inLocale)
Returns a name for the locale that is appropriate for display to the user. This will be the values returned by getDisplayLanguage(), getDisplayCountry(), and getDisplayVariant() assembled into a single string. The display name will have one of the following forms:

language (country, variant)

language (country)

language (variant)

country (variant)

language

country

variant

depending on which fields are specified in the locale. If the language, country, and variant fields are all empty, this function returns the empty string.
Usages and Demos :

View More Examples of getDisplayName(Locale inLocale)
   1: 
   2: import java.util.Locale;
   3: 
   4:         ...
   5: public class DictionarySpec implements TitleProvider {
   6:     private Locale from;
   7: 
   8:         ...
   9:     private Locale to;
  10: 
  11:         ...
  12:     public String getTitle(Locale locale) {
  13:         return from.getDisplayName(locale) + " ? " + to.getDisplayName(locale);

View Full Code Here
   1: import java.util.HashMap;
   2: import java.util.Locale;
   3: import java.util.Map;
   4:         ...
   5:             try {
   6:                 flag = GUIMediator.getThemeImage("flags/" + countryCode.toUpperCase(Locale.US));
   7:             } catch(MissingResourceException mse) {}
   8:         ...
   9:             
  10:             if (value instanceof Locale) {
  11:                 Locale locale = (Locale) value;
  12:         ...
  13:                 setIcon(LanguageFlagFactory.getFlag(locale.getCountry(), locale.getLanguage()));
  14:                 setText(locale.getDisplayName(locale));

View Full Code Here
   1: import java.util.List;
   2: import java.util.Locale;
   3: 
   4:         ...
   5:         for (Iterator iter = col.iterator(); iter.hasNext();) {
   6:             Locale locale = (Locale) iter.next();
   7:             String code = locale.getLanguage();
   8:         ...
   9:             }
  10:             String name = locale.getDisplayName(MessagesManager.getCurrentLocale(request));
  11:             SelectOption option = new SelectOption(name, code);

View Full Code Here
   1: import java.util.Arrays;
   2: import java.util.Locale;
   3: import java.util.Properties;
   4:         ...
   5: 
   6:             String locale = subDir.getName();
   7: 
   8:         ...
   9:             String localeName   = getLocaleName(locale);
  10:             String transVersion = getDocVersion(locale);
  11:         ...
  12:         Locale locale = new Locale(language, country);
  13:         return locale.getDisplayName(locale);

View Full Code Here

getDisplayVariant

public final String getDisplayVariant()
Returns a name for the locale's variant code that is appropriate for display to the user. If possible, the name will be localized for the default locale. If the locale doesn't specify a variant code, this function returns the empty string.
Usages and Demos :

View More Examples of getDisplayVariant()
   1: 
   2: import java.util.Locale;
   3: 
   4:         ...
   5: 
   6:         final Locale[] locales = MessageText.getLocales();
   7: 
   8:         ...
   9:         for (int i = 0; i < locales.length; i++) {
  10:             Locale locale = locales[i];
  11: 
  12:         ...
  13:             sName1 = locale.getDisplayVariant(locale);
  14:             sName2 = locale.getDisplayVariant();

View Full Code Here

getDisplayVariant

public String getDisplayVariant(Locale inLocale)
Returns a name for the locale's variant code that is appropriate for display to the user. If possible, the name will be localized for inLocale. If the locale doesn't specify a variant code, this function returns the empty string.
Usages and Demos :

View More Examples of getDisplayVariant(Locale inLocale)
   1: 
   2: import java.util.Locale;
   3: 
   4:         ...
   5: 
   6:         final Locale[] locales = MessageText.getLocales();
   7: 
   8:         ...
   9:         for (int i = 0; i < locales.length; i++) {
  10:             Locale locale = locales[i];
  11: 
  12:         ...
  13: 
  14:             sName1 = locale.getDisplayVariant(locale);

View Full Code Here
   1: import java.util.HashMap;
   2: import java.util.Locale;
   3: 
   4:         ...
   5:         
   6:         Locale locale = Localizer.getUsedLocale();
   7:         languageList.setSelectedValue( locale, true );
   8:         ...
   9:                 String text = locale.getDisplayLanguage(locale);
  10:                 String variant = locale.getDisplayVariant( locale );
  11:                 if ( variant != null && variant.length() > 0 )

View Full Code Here

getISO3Country

public String getISO3Country()
            throws MissingResourceException
Returns a three-letter abbreviation for this locale's country. If the locale doesn't specify a country, this will be the empty string. Otherwise, this will be an uppercase ISO 3166 3-letter country code. The ISO 3166-2 country codes can be found on-line at http://www.davros.org/misc/iso3166.txt
Throws:
MissingResourceException - Throws MissingResourceException if the three-letter country abbreviation is not available for this locale.
Usages and Demos :

View More Examples of getISO3Country()
   1: import java.util.Locale;
   2: 
   3:         ...
   4: {
   5:   GERMANY( Locale.GERMANY ), UK( Locale.UK ), CHINA( Locale.CHINA );
   6: 
   7:         ...
   8:   private Locale country;
   9: 
  10:         ...
  11:   {
  12:     return country.getISO3Country();

View Full Code Here

getISO3Language

public String getISO3Language()
            throws MissingResourceException
Returns a three-letter abbreviation for this locale's language. If the locale doesn't specify a language, this will be the empty string. Otherwise, this will be a lowercase ISO 639-2/T language code. The ISO 639-2 language codes can be found on-line at http://www.loc.gov/standards/iso639-2/englangn.html
Throws:
MissingResourceException - Throws MissingResourceException if the three-letter language abbreviation is not available for this locale.
Usages and Demos :

View More Examples of getISO3Language()
   1: import java.util.Iterator;
   2: import java.util.Locale;
   3: import java.util.MissingResourceException;
   4:         ...
   5:     
   6:     private Locale locale;
   7:     
   8:         ...
   9:         try {
  10:             return locale.getISO3Language();
  11:         } catch (MissingResourceException exception) {

View Full Code Here
   1: 
   2: import java.util.Locale;
   3: import java.util.Arrays;
   4:         ...
   5:     
   6:     private Locale locale;
   7:     
   8:         ...
   9:         try {
  10:             return locale.getISO3Language();
  11:         } catch (MissingResourceException exception) {

View Full Code Here

getISOCountries

public static String[] getISOCountries()
Returns a list of all 2-letter country codes defined in ISO 3166. Can be used to create Locales.
Usages and Demos :

View More Examples of getISOCountries()
   1: import java.util.List;
   2: import java.util.Locale;
   3: import java.util.TreeMap;
   4:         ...
   5:     public int getChildCount(){
   6:         return Locale.getISOCountries().length;
   7:     }
   8:         ...
   9:     public List getChildren(){
  10:         String[] availableCountries = Locale.getISOCountries();
  11:         
  12:         ...
  13:         Locale currentLocale;

View Full Code Here
   1: import java.awt.event.ItemListener;
   2: import java.util.Locale;
   3: 
   4:         ...
   5: 
   6:     private AllLocalesSelectionDialog(Dialog dialog, Locale select) {
   7:         super(dialog);
   8:         ...
   9: 
  10:     private AllLocalesSelectionDialog(Frame frame, Locale select) {
  11:         super(frame);
  12:         ...
  13:     private JComboBox createCountryOption() {
  14:         JComboBox box = new JComboBox(Locale.getISOCountries());

View Full Code Here

getISOLanguages

public static String[] getISOLanguages()
Returns a list of all 2-letter language codes defined in ISO 639. Can be used to create Locales. [NOTE: ISO 639 is not a stable standard-- some languages' codes have changed. The list this function returns includes both the new and the old codes for the languages whose codes have changed.]
Usages and Demos :

View More Examples of getISOLanguages()
   1: import java.util.Arrays;
   2: import java.util.Locale;
   3: import java.util.Date;
   4:         ...
   5: 
   6:   private final static List countries = Arrays.asList(Locale.getISOCountries());
   7:         ...
   8:   private final static List languages = Arrays.asList(Locale.getISOLanguages());

View Full Code Here
   1: import java.awt.event.ItemListener;
   2: import java.util.Locale;
   3: 
   4:         ...
   5: 
   6:     private AllLocalesSelectionDialog(Dialog dialog, Locale select) {
   7:         super(dialog);
   8:         ...
   9: 
  10:     private AllLocalesSelectionDialog(Frame frame, Locale select) {
  11:         super(frame);
  12:         ...
  13:     private JComboBox createLanguageOption(Locale select) {
  14:         JComboBox box = new JComboBox(Locale.getISOLanguages());

View Full Code Here

getLanguage

public String getLanguage()
Returns the language code for this locale, which will either be the empty string or a lowercase ISO 639 code.

NOTE: ISO 639 is not a stable standard-- some languages' codes have changed. Locale's constructor recognizes both the new and the old codes for the languages whose codes have changed, but this function always returns the old code. If you want to check for a specific language whose code has changed, don't do

 if (locale.getLanguage().equals("he")
    ...
 
Instead, do
 if (locale.getLanguage().equals(new Locale("he", "", "").getLanguage())
    ...
See Also:
getDisplayLanguage
Usages and Demos :

View More Examples of getLanguage()
   1: 
   2: import java.util.Locale;
   3: 
   4:         ...
   5: 
   6:     public static Locale getLocale(String localeString) {
   7:         int separatorIndex = localeString.indexOf("_");
   8:         ...
   9:         String language = localeString.substring(separatorIndex + 1, localeString.length());
  10:         return new Locale(language, country);
  11:     }
  12:         ...
  13:     public static String getLocaleString(Locale locale) {
  14:         return locale.getCountry() + "_" + locale.getLanguage();

View Full Code Here
   1: import java.util.Iterator;
   2: import java.util.Locale;
   3: import java.util.Map;
   4:         ...
   5: 
   6:     public String getText(String name, Locale locale)
   7:     {
   8:         ...
   9:             }
  10:             Locale languageOnly = new Locale(locale.getLanguage());
  11:             if (namedLocalizedText.containsKey(languageOnly))

View Full Code Here
   1: import java.util.List;
   2: import java.util.Locale;
   3: import java.util.zip.ZipEntry;
   4:         ...
   5: 
   6:     public static void setLocale(Locale locale) {
   7:         ...
   8:         ApplicationSettings.LANGUAGE.setValue(locale.getLanguage());
   9:         ApplicationSettings.COUNTRY.setValue(locale.getCountry());
  10:         ...
  11:     public static boolean isEnglishLocale(Locale locale) {
  12:         return Locale.ENGLISH.getLanguage().equals(locale.getLanguage());

View Full Code Here
   1: import java.util.Map;
   2: import java.util.Locale;
   3: import java.io.IOException;
   4:         ...
   5:     
   6:     public Locale getDefaultLocale()
   7:     {
   8:         ...
   9: 
  10:     public String getTitle (Locale locale,
  11:                             Client client)
  12:         ...
  13:         if (!locale.getVariant().equals("")) { 
  14:             locale = new Locale(locale.getLanguage(),locale.getCountry(), "");

View Full Code Here
   1: import java.util.Iterator;
   2: import java.util.Locale;
   3: import java.util.MissingResourceException;
   4:         ...
   5: 
   6:     private Language createLanguage(Locale locale, ResourceBundle bundle)
   7:     {
   8:         ...
   9:         {
  10:             locale = new Locale(locale.getLanguage(), locale.getCountry());                                
  11:         }
  12:         ...
  13:             {
  14:                 locale = new Locale(locale.getLanguage(), "");

View Full Code Here

getVariant

public String getVariant()
Returns the variant code for this locale.
See Also:
getDisplayVariant
Usages and Demos :

View More Examples of getVariant()
   1: 
   2: import java.util.Locale;
   3: import java.util.StringTokenizer;
   4:         ...
   5: public final class LocaleHelper {
   6:     public static Locale parseLocale(String localeString) {
   7:         StringTokenizer localeParser = new StringTokenizer(localeString, "-_");
   8:         ...
   9:         if (lang != null && country != null && variant != null)
  10:             return new Locale(lang, country, variant);
  11:         else if (lang != null && country != null)
  12:         ...
  13:         boolean hasCountry = !locale.getCountry().equals("");
  14:         boolean hasVariant = !locale.getVariant().equals("");

View Full Code Here
   1: 
   2: import java.util.Locale;
   3: import java.util.StringTokenizer;
   4:         ...
   5:   {
   6:     Locale l = (Locale) o;
   7:     if (l.getCountry().equals(""))
   8:         ...
   9:     }
  10:     else if (l.getVariant().equals(""))
  11:     {
  12:         ...
  13:     {
  14:       return l.getLanguage() + "_" + l.getCountry() + "_" + l.getVariant();

View Full Code Here
   1: 
   2:     public void addBundle(String name, Locale locale, DResourceBundle bundle) {
   3:         Map<String, DResourceBundle> bundlesByLocale = bundlesByName.get(name);
   4:         ...
   5: 
   6:         bundlesByLocale.put(getString(locale), bundle);
   7:     }
   8:         ...
   9:         boolean hasCountry = !locale.getCountry().equals("");
  10:         boolean hasVariant = !locale.getVariant().equals("");
  11: 
  12:         ...
  13:         if (hasLanguage && hasCountry && hasVariant)
  14:             return locale.getLanguage() + '-' + locale.getCountry() + '-' + locale.getVariant();

View Full Code Here
   1: package org.apache.jetspeed.om.impl;
   2: import java.util.Locale;
   3: 
   4:         ...
   5:     protected String name;
   6:     protected Locale locale;
   7:     
   8:         ...
   9:         {    
  10:             hasher.append(locale.getCountry()).append(locale.getLanguage()).append(locale.getVariant());
  11:         }

View Full Code Here
   1: import java.util.Enumeration;
   2: import java.util.Locale;
   3: import java.util.PropertyResourceBundle;
   4:         ...
   5:   public LocalizationContext getBundle(String name, String cacheKey,
   6:                                        Enumeration<Locale> locales)
   7:   {
   8:         ...
   9:     while (locales.hasMoreElements()) {
  10:       Locale locale = locales.nextElement();
  11: 
  12:         ...
  13:                        locale.getCountry() + '_' +
  14:                        locale.getVariant());

View Full Code Here

hashCode

public int hashCode()
Override hashCode. Since Locales are often used in hashtables, caches the value for speed.
Overrides:
hashCode in interface Object
Usages and Demos :

View More Examples of hashCode()
   1: import java.util.ListResourceBundle;
   2: import java.util.Locale;
   3: import java.util.ResourceBundle;
   4:         ...
   5: 
   6:     private Locale         locale;
   7:     private String         title;
   8:         ...
   9:     public int hashCode() {
  10:         return locale.hashCode();
  11:     }

View Full Code Here
   1: import java.util.HashMap;
   2: import java.util.Locale;
   3: import java.util.Map;
   4:         ...
   5:         private int m_hashcode;
   6:         private Locale m_locale;
   7: 
   8:         ...
   9: 
  10:         BundleKey(String s, Locale l) {
  11: 
  12:         ...
  13:             m_locale = l;
  14:             m_hashcode = m_baseName.hashCode() ^ m_locale.hashCode();

View Full Code Here
   1: import java.util.Date;
   2: import java.util.Locale;
   3: import java.util.MissingResourceException;
   4:         ...
   5: 
   6:     private Locale m_locale;
   7: 
   8:         ...
   9:     public CmsMessages(String bundleName, Locale locale) {
  10: 
  11:         ...
  12: 
  13:         return m_locale.hashCode() + (m_bundleName == null ? 0 : m_bundleName.hashCode());

View Full Code Here
   1: 
   2: import java.util.Locale;
   3: import java.util.regex.Matcher;
   4:         ...
   5:                     this.countryCode = m.group(2);
   6:                 this.locale = new Locale(this.languageCode.toLowerCase(), 
   7:                         this.countryCode.toUpperCase());
   8:         ...
   9:     {
  10:         return locale.hashCode();
  11:     }

View Full Code Here
   1: import java.util.List;
   2: import java.util.Locale;
   3: import java.util.Map;
   4:         ...
   5:     private final boolean mTimeZoneForced;
   6:     private final Locale mLocale;
   7:     private final boolean mLocaleForced;
   8:         ...
   9: 
  10:     public static FastDateFormat getInstance(String pattern, Locale locale) {
  11:         return getInstance(pattern, null, locale);
  12:         ...
  13:         int total = 0;
  14:         total += mPattern.hashCode();

View Full Code Here

setDefault

public static void setDefault(Locale newLocale)
Sets the default locale for this instance of the Java Virtual Machine. This does not affect the host locale.

If there is a security manager, its checkPermission method is called with a PropertyPermission("user.language", "write") permission before the default locale is changed.

The Java Virtual Machine sets the default locale during startup based on the host environment. It is used by many locale-sensitive methods if no locale is explicitly specified.

Since changing the default locale may affect many different areas of functionality, this method should only be used if the caller is prepared to reinitialize locale-sensitive code running within the same Java Virtual Machine, such as the user interface.

Parameters:
newLocale - the new default locale
Throws:
SecurityException - if a security manager exists and its checkPermission method doesn't allow the operation.
NullPointerException - if newLocale is null
See Also:
SecurityManager.checkPermission, PropertyPermission
Usages and Demos :

View More Examples of setDefault(Locale newLocale)
   1: import java.awt.event.WindowEvent;
   2: import java.util.Locale;
   3: import java.util.logging.Level;
   4:         ...
   5:     public static void main(String[] args) {
   6:         Locale.setDefault(Locale.ENGLISH);
   7:         System.setProperty("user.language", "");
   8:         setKunststoffLookAndFeel();

View Full Code Here
   1: 
   2: import java.util.Locale;
   3: 
   4:         ...
   5: public class DayConverterTest extends TestCase {
   6:     private Locale defaultLocale;
   7: 
   8:         ...
   9:         super.setUp();
  10:         defaultLocale = Locale.getDefault();
  11:         ...
  12:         Locale.setDefault(Locale.US);

View Full Code Here
   1:       if (argv[0].equalsIgnoreCase("canada"))
   2:         java.util.Locale.setDefault(java.util.Locale.CANADA);
   3:       if (argv[0].equalsIgnoreCase("canada_french"))
   4:         ...
   5:         java.util.Locale.setDefault(java.util.Locale.CANADA_FRENCH);
   6:       if (argv[0].equalsIgnoreCase("china"))
   7:         ...
   8:         java.util.Locale.setDefault(java.util.Locale.CHINA);
   9:       if (argv[0].equalsIgnoreCase("france"))
  10:         ...
  11:         java.util.Locale.setDefault(java.util.Locale.FRANCE);

View Full Code Here
   1: import java.util.List;
   2: import java.util.Locale;
   3: 
   4:         ...
   5: 
   6:     private Locale defaultLocale;
   7: 
   8:         ...
   9:     protected void setUp() throws Exception {
  10:         defaultLocale = Locale.getDefault();
  11:     }
  12:         ...
  13:     protected void tearDown() throws Exception {
  14:         Locale.setDefault(defaultLocale);

View Full Code Here
   1: import java.util.Calendar;
   2: import java.util.Locale;
   3: import java.util.TimeZone;
   4:         ...
   5:     public void testStartOfWeekDate() throws ParseException {
   6:         Locale.setDefault(Locale.ENGLISH);
   7: 
   8:         ...
   9:     public void testEndOfWeekDate() throws ParseException {
  10:         Locale.setDefault(Locale.ENGLISH);
  11:         
  12:         ...
  13:     public void testDayOfWeek() throws ParseException {
  14:         Locale.setDefault(Locale.ENGLISH);

View Full Code Here

toString

public final String toString()
Getter for the programmatic name of the entire locale, with the language, country and variant separated by underbars. Language is always lower case, and country is always upper case. If the language is missing, the string will begin with an underbar. If both the language and country fields are missing, this function will return the empty string, even if the variant field is filled in (you can't have a locale with just a variant-- the variant must accompany a valid language or country code). Examples: "en", "de_DE", "_GB", "en_US_WIN", "de__POSIX", "fr__MAC"
Overrides:
toString in interface Object
See Also:
getDisplayName
Usages and Demos :

View More Examples of toString()
   1: 
   2: import java.util.Locale;
   3: import java.util.Comparator;
   4:         ...
   5:     {
   6:         if (obj1 instanceof Locale && obj2 instanceof Locale)
   7:         {
   8:         ...
   9:             {
  10:                 return locale1.toString().compareTo(locale2.toString());
  11:             }

View Full Code Here
   1: 
   2: import java.util.Locale;
   3: import javax.xml.namespace.QName;
   4:         ...
   5: 
   6:     public static String toLanguage(Locale locale) {
   7:         ...
   8:         return locale.toString().replace('_', '-');
   9:     }

View Full Code Here
   1: 
   2:         Locale expected = new Locale("en", "CA");
   3:         ...
   4:         Locale received = request.getLocale();
   5:         if (received == null)
   6:         ...
   7:             writer.println("GetLocales01 FAILED - Expected='" +
   8:                            expected.toString() + "' Received='" +
   9:         ...
  10:                            received.toString() + "'");

View Full Code Here
   1: import java.util.List;
   2: import java.util.Locale;
   3: import java.util.Map;
   4:         ...
   5: {
   6:     private Locale currentLocale;
   7:     private static final Logger logger = Logger.getLogger(LocaleManagerBean.class.getName());
   8:         ...
   9:         HttpSession session = request.getSession(true);
  10:         currentLocale = (Locale) session.getAttribute("locale");
  11:         if (currentLocale == null)
  12:         ...
  13:     {
  14:         return currentLocale.toString();

View Full Code Here
   1: import java.util.HashSet;
   2: import java.util.Locale;
   3: 
   4:         ...
   5: 
   6:     private Locale locale;
   7: 
   8:         ...
   9:             context.getWriter().writeAttributeString("language",
  10:                     locale.toString());
  11:     }
  12:         ...
  13:             else if (element instanceof Break) {
  14:                 String s = b.toString();

View Full Code Here