Hey Kip - thanks for this library!
I’m trying to determine whether I should use CLDR or AINA, or both, to specify languages in my app.
Your library/CLDR follows RFC 5646.
W3 also recommends RFC 5646 -
https://www.w3.org/International/articles/language-tags/ … but also refers to https://www.iana.org/assignments/language-subtag-registry/language-subtag-registry as the source of truth for RFC 5646.
However, some language codes in iana’s registry are not available in Cldr’s registry:
iex(27)> Enum.member?(MyApp.Cldr.Language.all_languages(), "adq")
false
CLDR still parses it and gets the language key filled out, though:
iex(28)> Cldr.Locale.new("adq", Onward.Cldr)
{:ok,
%Cldr.LanguageTag{
canonical_locale_name: "adq-Latn-US",
cldr_locale_name: nil,
extensions: %{},
gettext_locale_name: nil,
language: "adq",
language_subtags: [],
language_variant: nil,
locale: %{},
private_use: [],
rbnf_locale_name: nil,
requested_locale_name: "adq",
script: "Latn",
territory: "US",
transform: %{}
}}
so that’s great. But that language isn’t found:
iex(29)> MyApp.Cldr.Number.to_string 12345, locale: "adq"
{:error, {Cldr.UnknownLocaleError, "The locale \"adq\" is not known."}}
Do you know why does CLDR not have a language code that AINA has, given they’re following the same spec?
I think it’s because the spec is bcp47, which they both follow… But I’m not sure how AINA has a higher quantity of language tags, where CLDR has language-REGION tag combos which are not specified IANA’s registry.
I’m ultimately trying to ensure I’m using languages properly as my organization has a massive amount of languages.
I’m wondering about storing AINA’s codes separately from CLDR, and using your library to augment AINA’s codes where possible with the wealth of extra data your lib provides. Just was interested in your thoughts on AINA vs. CLDR if you had any, and if you think there’s room to use both.
Thanks!