Cannot figure out how to convert java convert alpha-3 language code to alpha-2 to be able sent locale as string in the following format "sv_SE".
Language enum class(which is used in a lot of places of event based services):
public enum Language {
ENG,
TUR,
...
}
Country enum class:
public enum CountryCode {
AD,
AE,
...
}
Tried to get alpha-2 language code:
new Locale(Language.ENG.name(), CountryCode.AU.name()).getLanguage(); // still return alpha-3 language code
How alpha-3 language code can be converted to alpha-2 in elegant way without hardcoded mapping in code?