home *** CD-ROM | disk | FTP | other *** search
- package java.util;
-
- import java.io.Serializable;
-
- public final class Locale implements Cloneable, Serializable {
- public static final Locale ENGLISH = new Locale("en", "", "");
- public static final Locale FRENCH = new Locale("fr", "", "");
- public static final Locale GERMAN = new Locale("de", "", "");
- public static final Locale ITALIAN = new Locale("it", "", "");
- public static final Locale JAPANESE = new Locale("ja", "", "");
- public static final Locale KOREAN = new Locale("ko", "", "");
- public static final Locale CHINESE = new Locale("zh", "", "");
- public static final Locale SIMPLIFIED_CHINESE = new Locale("zh", "CN", "");
- public static final Locale TRADITIONAL_CHINESE = new Locale("zh", "TW", "");
- public static final Locale FRANCE = new Locale("fr", "FR", "");
- public static final Locale GERMANY = new Locale("de", "DE", "");
- public static final Locale ITALY = new Locale("it", "IT", "");
- public static final Locale JAPAN = new Locale("ja", "JP", "");
- public static final Locale KOREA = new Locale("ko", "KR", "");
- public static final Locale CHINA = new Locale("zh", "CN", "");
- public static final Locale PRC = new Locale("zh", "CN", "");
- public static final Locale TAIWAN = new Locale("zh", "TW", "");
- // $FF: renamed from: UK java.util.Locale
- public static final Locale field_0 = new Locale("en", "GB", "");
- // $FF: renamed from: US java.util.Locale
- public static final Locale field_1 = new Locale("en", "US", "");
- public static final Locale CANADA = new Locale("en", "CA", "");
- public static final Locale CANADA_FRENCH = new Locale("fr", "CA", "");
- private String language = "";
- private String country = "";
- private String variant = "";
- private int hashcode = -1;
- private static Locale defaultLocale = null;
-
- public Locale(String var1, String var2, String var3) {
- this.language = this.toLowerCase(var1);
- this.country = this.toUpperCase(var2);
- this.variant = this.toUpperCase(var3);
- }
-
- public Locale(String var1, String var2) {
- this.language = this.toLowerCase(var1);
- this.country = this.toUpperCase(var2);
- this.variant = "";
- }
-
- public static synchronized Locale getDefault() {
- if (defaultLocale == null) {
- String var0 = System.getProperty("user.language", "EN");
- String var1 = System.getProperty("user.region", "");
- defaultLocale = new Locale(var0, var1);
- }
-
- return defaultLocale;
- }
-
- public static synchronized void setDefault(Locale var0) {
- SecurityManager var1 = System.getSecurityManager();
- if (var1 != null) {
- var1.checkPropertyAccess("user.language");
- }
-
- defaultLocale = var0;
- }
-
- public String getLanguage() {
- return this.language;
- }
-
- public String getCountry() {
- return this.country;
- }
-
- public String getVariant() {
- return this.variant;
- }
-
- public final String toString() {
- StringBuffer var1 = new StringBuffer(this.language);
- if (this.country.length() != 0) {
- var1.append('_');
- var1.append(this.country);
- if (this.variant.length() != 0) {
- var1.append('_');
- var1.append(this.variant);
- }
- }
-
- return var1.toString();
- }
-
- public String getISO3Language() throws MissingResourceException {
- ResourceBundle var1 = ResourceBundle.getBundle("java.text.resources.LocaleElements", this);
- return var1.getString("ShortLanguage");
- }
-
- public String getISO3Country() throws MissingResourceException {
- ResourceBundle var1 = ResourceBundle.getBundle("java.text.resources.LocaleElements", this);
- return var1.getString("ShortCountry");
- }
-
- private int getLCID() throws MissingResourceException {
- ResourceBundle var1 = ResourceBundle.getBundle("java.text.resources.LocaleElements", this);
- String var2 = var1.getString("LocaleID");
- return Integer.parseInt(var2, 16);
- }
-
- public final String getDisplayLanguage() {
- return this.getDisplayLanguage(getDefault());
- }
-
- public String getDisplayLanguage(Locale var1) {
- try {
- ResourceBundle var2 = ResourceBundle.getBundle("java.text.resources.LocaleElements", this);
- return this.findStringMatch((String[][])var2.getObject("Languages"), var1.language, this.language);
- } catch (Exception var3) {
- return this.language;
- }
- }
-
- public final String getDisplayCountry() {
- return this.getDisplayCountry(getDefault());
- }
-
- public String getDisplayCountry(Locale var1) {
- try {
- ResourceBundle var2 = ResourceBundle.getBundle("java.text.resources.LocaleElements", this);
- return this.findStringMatch((String[][])var2.getObject("Countries"), var1.language, this.language);
- } catch (Exception var3) {
- return this.country;
- }
- }
-
- public final String getDisplayVariant() {
- return this.getDisplayVariant(getDefault());
- }
-
- public String getDisplayVariant(Locale var1) {
- try {
- ResourceBundle var2 = ResourceBundle.getBundle("java.text.resources.LocaleElements", var1);
- String[][] var3 = (String[][])var2.getObject("Variants");
- return var3 == null ? this.variant : this.findStringMatch(var3, var1.language, this.language);
- } catch (Exception var4) {
- return this.variant;
- }
- }
-
- public final String getDisplayName() {
- return this.getDisplayName(getDefault());
- }
-
- public String getDisplayName(Locale var1) {
- StringBuffer var2 = new StringBuffer(this.getDisplayLanguage(var1));
- String var3 = this.getDisplayCountry(var1);
- String var4 = this.getDisplayVariant(var1);
- if (var3.length() != 0 || var4.length() != 0) {
- var2.append(" (");
- var2.append(this.getDisplayCountry(var1));
- if (var3.length() != 0 && var4.length() != 0) {
- var2.append(",");
- }
-
- var2.append(this.getDisplayVariant(var1));
- var2.append(")");
- }
-
- return var2.toString();
- }
-
- public Object clone() {
- try {
- Locale var1 = (Locale)super.clone();
- return var1;
- } catch (CloneNotSupportedException var2) {
- throw new InternalError();
- }
- }
-
- public synchronized int hashCode() {
- if (this.hashcode == -1) {
- this.hashcode = this.language.hashCode() ^ this.country.hashCode() ^ this.variant.hashCode();
- }
-
- return this.hashcode;
- }
-
- public boolean equals(Object var1) {
- if (this == var1) {
- return true;
- } else if (!(var1 instanceof Locale)) {
- return false;
- } else {
- Locale var2 = (Locale)var1;
- if (this.hashCode() != var2.hashCode()) {
- return false;
- } else if (!this.language.equals(var2.language)) {
- return false;
- } else if (!this.country.equals(var2.country)) {
- return false;
- } else {
- return this.variant.equals(var2.variant);
- }
- }
- }
-
- private String toLowerCase(String var1) {
- char[] var2 = var1.toCharArray();
-
- for(int var3 = 0; var3 < var2.length; ++var3) {
- var2[var3] = Character.toLowerCase(var2[var3]);
- }
-
- return new String(var2);
- }
-
- private String toUpperCase(String var1) {
- char[] var2 = var1.toCharArray();
-
- for(int var3 = 0; var3 < var2.length; ++var3) {
- var2[var3] = Character.toUpperCase(var2[var3]);
- }
-
- return new String(var2);
- }
-
- private String findStringMatch(String[][] var1, String var2, String var3) {
- for(int var4 = 0; var4 < var1.length; ++var4) {
- if (var2.equals(var1[var4][0])) {
- return var1[var4][1];
- }
- }
-
- if (!var3.equals(var2)) {
- for(int var5 = 0; var5 < var1.length; ++var5) {
- if (var3.equals(var1[var5][0])) {
- return var1[var5][1];
- }
- }
- }
-
- if (!"EN".equals(var2) && "EN".equals(var3)) {
- for(int var6 = 0; var6 < var1.length; ++var6) {
- if ("EN".equals(var1[var6][0])) {
- return var1[var6][1];
- }
- }
- }
-
- return "";
- }
-
- private boolean matches(Locale var1) {
- if (this.language.length() != 0 && !this.language.equals(var1.language)) {
- return false;
- } else if (this.country.length() != 0 && !this.country.equals(var1.country)) {
- return false;
- } else {
- return this.variant.length() == 0 || this.variant.equals(var1.variant);
- }
- }
- }
-