481 * @author Mark Davis |
481 * @author Mark Davis |
482 * @since 1.1 |
482 * @since 1.1 |
483 */ |
483 */ |
484 public final class Locale implements Cloneable, Serializable { |
484 public final class Locale implements Cloneable, Serializable { |
485 |
485 |
486 static private final Cache LOCALECACHE = new Cache(); |
486 private static final Cache LOCALECACHE = new Cache(); |
487 |
487 |
488 /** Useful constant for language. |
488 /** Useful constant for language. |
489 */ |
489 */ |
490 static public final Locale ENGLISH = createConstant("en", ""); |
490 public static final Locale ENGLISH = createConstant("en", ""); |
491 |
491 |
492 /** Useful constant for language. |
492 /** Useful constant for language. |
493 */ |
493 */ |
494 static public final Locale FRENCH = createConstant("fr", ""); |
494 public static final Locale FRENCH = createConstant("fr", ""); |
495 |
495 |
496 /** Useful constant for language. |
496 /** Useful constant for language. |
497 */ |
497 */ |
498 static public final Locale GERMAN = createConstant("de", ""); |
498 public static final Locale GERMAN = createConstant("de", ""); |
499 |
499 |
500 /** Useful constant for language. |
500 /** Useful constant for language. |
501 */ |
501 */ |
502 static public final Locale ITALIAN = createConstant("it", ""); |
502 public static final Locale ITALIAN = createConstant("it", ""); |
503 |
503 |
504 /** Useful constant for language. |
504 /** Useful constant for language. |
505 */ |
505 */ |
506 static public final Locale JAPANESE = createConstant("ja", ""); |
506 public static final Locale JAPANESE = createConstant("ja", ""); |
507 |
507 |
508 /** Useful constant for language. |
508 /** Useful constant for language. |
509 */ |
509 */ |
510 static public final Locale KOREAN = createConstant("ko", ""); |
510 public static final Locale KOREAN = createConstant("ko", ""); |
511 |
511 |
512 /** Useful constant for language. |
512 /** Useful constant for language. |
513 */ |
513 */ |
514 static public final Locale CHINESE = createConstant("zh", ""); |
514 public static final Locale CHINESE = createConstant("zh", ""); |
515 |
515 |
516 /** Useful constant for language. |
516 /** Useful constant for language. |
517 */ |
517 */ |
518 static public final Locale SIMPLIFIED_CHINESE = createConstant("zh", "CN"); |
518 public static final Locale SIMPLIFIED_CHINESE = createConstant("zh", "CN"); |
519 |
519 |
520 /** Useful constant for language. |
520 /** Useful constant for language. |
521 */ |
521 */ |
522 static public final Locale TRADITIONAL_CHINESE = createConstant("zh", "TW"); |
522 public static final Locale TRADITIONAL_CHINESE = createConstant("zh", "TW"); |
523 |
523 |
524 /** Useful constant for country. |
524 /** Useful constant for country. |
525 */ |
525 */ |
526 static public final Locale FRANCE = createConstant("fr", "FR"); |
526 public static final Locale FRANCE = createConstant("fr", "FR"); |
527 |
527 |
528 /** Useful constant for country. |
528 /** Useful constant for country. |
529 */ |
529 */ |
530 static public final Locale GERMANY = createConstant("de", "DE"); |
530 public static final Locale GERMANY = createConstant("de", "DE"); |
531 |
531 |
532 /** Useful constant for country. |
532 /** Useful constant for country. |
533 */ |
533 */ |
534 static public final Locale ITALY = createConstant("it", "IT"); |
534 public static final Locale ITALY = createConstant("it", "IT"); |
535 |
535 |
536 /** Useful constant for country. |
536 /** Useful constant for country. |
537 */ |
537 */ |
538 static public final Locale JAPAN = createConstant("ja", "JP"); |
538 public static final Locale JAPAN = createConstant("ja", "JP"); |
539 |
539 |
540 /** Useful constant for country. |
540 /** Useful constant for country. |
541 */ |
541 */ |
542 static public final Locale KOREA = createConstant("ko", "KR"); |
542 public static final Locale KOREA = createConstant("ko", "KR"); |
543 |
543 |
544 /** Useful constant for country. |
544 /** Useful constant for country. |
545 */ |
545 */ |
546 static public final Locale CHINA = SIMPLIFIED_CHINESE; |
546 public static final Locale CHINA = SIMPLIFIED_CHINESE; |
547 |
547 |
548 /** Useful constant for country. |
548 /** Useful constant for country. |
549 */ |
549 */ |
550 static public final Locale PRC = SIMPLIFIED_CHINESE; |
550 public static final Locale PRC = SIMPLIFIED_CHINESE; |
551 |
551 |
552 /** Useful constant for country. |
552 /** Useful constant for country. |
553 */ |
553 */ |
554 static public final Locale TAIWAN = TRADITIONAL_CHINESE; |
554 public static final Locale TAIWAN = TRADITIONAL_CHINESE; |
555 |
555 |
556 /** Useful constant for country. |
556 /** Useful constant for country. |
557 */ |
557 */ |
558 static public final Locale UK = createConstant("en", "GB"); |
558 public static final Locale UK = createConstant("en", "GB"); |
559 |
559 |
560 /** Useful constant for country. |
560 /** Useful constant for country. |
561 */ |
561 */ |
562 static public final Locale US = createConstant("en", "US"); |
562 public static final Locale US = createConstant("en", "US"); |
563 |
563 |
564 /** Useful constant for country. |
564 /** Useful constant for country. |
565 */ |
565 */ |
566 static public final Locale CANADA = createConstant("en", "CA"); |
566 public static final Locale CANADA = createConstant("en", "CA"); |
567 |
567 |
568 /** Useful constant for country. |
568 /** Useful constant for country. |
569 */ |
569 */ |
570 static public final Locale CANADA_FRENCH = createConstant("fr", "CA"); |
570 public static final Locale CANADA_FRENCH = createConstant("fr", "CA"); |
571 |
571 |
572 /** |
572 /** |
573 * Useful constant for the root locale. The root locale is the locale whose |
573 * Useful constant for the root locale. The root locale is the locale whose |
574 * language, country, and variant are empty ("") strings. This is regarded |
574 * language, country, and variant are empty ("") strings. This is regarded |
575 * as the base locale of all locales, and is used as the language/country |
575 * as the base locale of all locales, and is used as the language/country |
576 * neutral locale for the locale sensitive operations. |
576 * neutral locale for the locale sensitive operations. |
577 * |
577 * |
578 * @since 1.6 |
578 * @since 1.6 |
579 */ |
579 */ |
580 static public final Locale ROOT = createConstant("", ""); |
580 public static final Locale ROOT = createConstant("", ""); |
581 |
581 |
582 /** |
582 /** |
583 * The key for the private use extension ('x'). |
583 * The key for the private use extension ('x'). |
584 * |
584 * |
585 * @see #getExtension(char) |
585 * @see #getExtension(char) |
586 * @see Builder#setExtension(char, String) |
586 * @see Builder#setExtension(char, String) |
587 * @since 1.7 |
587 * @since 1.7 |
588 */ |
588 */ |
589 static public final char PRIVATE_USE_EXTENSION = 'x'; |
589 public static final char PRIVATE_USE_EXTENSION = 'x'; |
590 |
590 |
591 /** |
591 /** |
592 * The key for Unicode locale extension ('u'). |
592 * The key for Unicode locale extension ('u'). |
593 * |
593 * |
594 * @see #getExtension(char) |
594 * @see #getExtension(char) |
595 * @see Builder#setExtension(char, String) |
595 * @see Builder#setExtension(char, String) |
596 * @since 1.7 |
596 * @since 1.7 |
597 */ |
597 */ |
598 static public final char UNICODE_LOCALE_EXTENSION = 'u'; |
598 public static final char UNICODE_LOCALE_EXTENSION = 'u'; |
599 |
599 |
600 /** serialization ID |
600 /** serialization ID |
601 */ |
601 */ |
602 static final long serialVersionUID = 9149081749638150636L; |
602 static final long serialVersionUID = 9149081749638150636L; |
603 |
603 |