mirror of
https://github.com/vanitasvitae/Smack.git
synced 2024-11-22 20:12:07 +01:00
Errors: language selection for error description
This commit is contained in:
parent
4ca2c7cc69
commit
093b576e0d
1 changed files with 16 additions and 8 deletions
|
@ -66,16 +66,24 @@ public class AbstractError {
|
||||||
* @return the descriptive text or null.
|
* @return the descriptive text or null.
|
||||||
*/
|
*/
|
||||||
public String getDescriptiveText() {
|
public String getDescriptiveText() {
|
||||||
String defaultLocale = Locale.getDefault().getLanguage();
|
if (descriptiveTexts.isEmpty())
|
||||||
String descriptiveText = getDescriptiveText(defaultLocale);
|
return null;
|
||||||
if (descriptiveText == null) {
|
// attempt to obtain the text in the user's locale, the English text, or the "" default
|
||||||
descriptiveText = getDescriptiveText("en");
|
Locale l = Locale.getDefault();
|
||||||
if (descriptiveText == null) {
|
String[] tags = new String[] {
|
||||||
descriptiveText = getDescriptiveText("");
|
l.getLanguage() + "-" + l.getCountry() + "-" + l.getVariant(),
|
||||||
}
|
l.getLanguage() + "-" + l.getCountry(),
|
||||||
}
|
l.getLanguage(),
|
||||||
|
"en",
|
||||||
|
""
|
||||||
|
};
|
||||||
|
for (String tag : tags) {
|
||||||
|
String descriptiveText = getDescriptiveText(tag);
|
||||||
|
if (descriptiveText != null)
|
||||||
return descriptiveText;
|
return descriptiveText;
|
||||||
}
|
}
|
||||||
|
return descriptiveTexts.values().iterator().next();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the descriptive test of this SASLFailure.
|
* Get the descriptive test of this SASLFailure.
|
||||||
|
|
Loading…
Reference in a new issue