Fixed behavior of Locale and implemented its toString().

This commit is contained in:
JET 2010-12-15 15:18:43 -07:00
parent 8c54446c67
commit 7270eb7879

View File

@ -30,11 +30,11 @@ public class Locale {
}
public Locale(String language, String country) {
this(language, country, null);
this(language, country, "");
}
public Locale(String language) {
this(language, null);
this(language, "");
}
public String getLanguage() {
@ -52,4 +52,13 @@ public class Locale {
public static Locale getDefault() {
return DEFAULT;
}
public final String toString() {
boolean hasLanguage = language != "";
boolean hasCountry = country != "";
boolean hasVariant = variant != "";
if (!hasLanguage && !hasCountry) return "";
return language + (hasCountry || hasVariant ? '_' + country : "") + (hasVariant ? '_' + variant : "");
}
}