Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change ConnectionConfiguration getXmlLang method #10

Merged
merged 1 commit into from
Dec 20, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -598,13 +598,14 @@ public Locale getLanguage() {
* @return the stream language to use when connecting to the server.
*/
public String getXmlLang() {
// TODO: Change to Locale.toLanguageTag() once Smack's minimum Android API level is 21 or higher.
// This will need a workaround for new Locale("").getLanguageTag() returning "und". Expected
// behavior of this function:
// - returns null if language is null
// - returns "" if language.getLanguage() returns the empty string
// - returns language.toLanguageTag() otherwise
return language != null ? language.toString().replace("_", "-") : null;
if (language == null) return null;
if (language.getLanguage().isEmpty()) return "";
String result = language.getLanguage();
String country = language.getCountry();
if (!country.isEmpty()) {
result = result + "-" + country;
}
return result;
}

/**
Expand Down
2 changes: 1 addition & 1 deletion version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
4.4.4-intermedia-1.3.0
4.4.4-intermedia-1.3.1
Loading