The way that language and locales are handled differs in code (if not much in result) between MDUI and attributes.
Attribute handling uses Locales driver by getXMLLangAsLocale in AttributeSupport. This strips the location and just gives what should be a the two letter language
MDUI uses the language string which comes from org.opensaml.core.xml.Langbearing and does full string comparison (so if you order things correctly you will see a difference between "en" "eb-gb" and "en-us").
Neither are consistent, nor necessarily correct. The Locale provides what looks like reasonable methods for handling these things. Do we want to ratiinalize this.
Such ratinalization might
- make LangBearing return a Locale, not a string
- make fuller use of Locale#forLanguageTag()
- make fuller use of the (standards following) Locale#filter() methods.