For #1116 - Fix the language code generation

nightly-build-test
Jeff Boek 5 years ago committed by Colin Lee
parent e9edd6c8b5
commit f741213c4a

@ -27,7 +27,7 @@ object SupportUtils {
val escapedTopic = getEncodedTopicUTF8(topic.topicStr)
val appVersion = getAppVersion(context)
val osTarget = "Android"
val langTag = Locale.getDefault().isO3Language
val langTag = getLanguageTag(Locale.getDefault())
return "https://support.mozilla.org/1/mobile/$appVersion/$osTarget/$langTag/$escapedTopic"
}
@ -47,4 +47,12 @@ object SupportUtils {
throw IllegalStateException("Unable find package details for Fenix", e)
}
}
private fun getLanguageTag(locale: Locale): String {
val language = locale.language
val country = locale.country // Can be an empty string.
return if (country == "") {
language
} else "$language-$country"
}
}

Loading…
Cancel
Save