ex_cldr handles RFC compliant language tags and also manages fallbacks to supported languages. For a somewhat extreme example:
iex> MyApp.Cldr.validate_locale "en-AU-u-nu-latn-cu-AUD-cf-account-tz-ausyd"
{:ok,
%Cldr.LanguageTag{
canonical_locale_name: "en-Latn-AU",
cldr_locale_name: "en",
extensions: %{},
gettext_locale_name: nil,
language: "en",
language_subtags: [],
language_variant: nil,
locale: %{
currency: :AUD,
currency_format: :accounting,
number_system: :latn,
timezone: "Australia/Sydney"
},
private_use: [],
rbnf_locale_name: "en",
requested_locale_name: "en-AU",
script: "Latn",
territory: "AU",
transform: %{}
}}
Which should tell you pretty much everything you need to know. And there are other related libs for format dates, numbers, units (and soon messages) etc as required.