mirror of
https://github.com/corda/corda.git
synced 2025-01-07 13:38:47 +00:00
Fixed behavior of Locale and implemented its toString().
This commit is contained in:
parent
8c54446c67
commit
7270eb7879
@ -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 : "");
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user