elixir-cldr / cldr

Elixir implementation of CLDR/ICU

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

A "und" locale IS being added automatically in my project

nicolasblanco opened this issue · comments

Hello!

Thank you for this great project.

I'm just wondering why there is a "und" locale being added automatically to my project, I have no ideas what it is.

My config is simply:

config :moning, Moning.Cldr,
  default_locale: "en",
  locales: ["fr", "en", "de"],
  add_fallback_locales: false,
  gettext: Moning.Gettext,
  providers: [Cldr.Territory, Cldr.Number]

When I'm running the app, I'm getting:

➜  moning git:(master) iex -S mix
Erlang/OTP 24 [erts-12.2.1] [source] [64-bit] [smp:8:8] [ds:8:8:10] [async-threads:1] [dtrace]

Compiling 230 files (.ex)

Generating Moning.Cldr for 4 locales named [:de, :en, :fr, :und] with a default locale named :en
Generated moning app

@nicolasblanco thanks for the report. The und locale is what used to be called the root locale. And while its not a locale that can be set it does contain fallback information that us used in various places in ex_cldr. So und is required and is force configured. This makes the message confusing as you say. Would it be better to omit und from the compilation message so you don't see anything unexpected and confusing?

I'm curious, why the name changed from root to und?

I don't actually know the formal reason. But und is the standard CLDR way of representing undefined. And since the root locale (now und locale) does not represent any known language so I suppose its a reasonable normalisation. At the time of this change, und also became the standard way to represent undefined in other parts of CLDR too.