elixir-cldr / cldr_dates_times

Date & times formatting functions for the Common Locale Data Repository (CLDR) package https://github.com/elixir-cldr/cldr
Other
68 stars 13 forks source link

No Default Backend Error when using Cldr Implementation #18

Closed maennchen closed 3 years ago

maennchen commented 3 years ago

Code

defmodule AcmeCldr do
  @moduledoc false

  use Cldr,
    default_locale: "en-CH",
    locales: ["en-CH", "de-CH", "fr-CH", "it-CH"],
    gettext: AcmeGettext,
    data_dir: "./priv/cldr",
    otp_app: :hygeia_cldr,
    providers: [Cldr.Number, Cldr.List, Cldr.Calendar, Cldr.DateTime, Cldr.Unit, Cldr.Language],
    generate_docs: true,
    force_locale_download: false
end
AcmeCldr.Date.to_string!(Date.utc_today())

Result

** (Cldr.NoDefaultBackendError) No default :ex_cldr backend is configured
    (ex_cldr 2.18.2) lib/cldr/config/config.ex:328: Cldr.Config.default_backend/0
    (ex_cldr 2.18.2) lib/cldr.ex:434: Cldr.put_default_locale/1
    (ex_cldr 2.18.2) lib/cldr.ex:380: Cldr.default_locale/0
    (ex_cldr_dates_times 2.6.1) lib/cldr/date.ex:121: Cldr.Date.normalize_options/2
    (ex_cldr_dates_times 2.6.1) lib/cldr/date.ex:97: Cldr.Date.to_string/3

Expected

A formatted Date

Versions

The only affected version is 2.6.1, 2.6.0 works without any problems.

kipcole9 commented 3 years ago

Thanks for the report. Clearly a regression. Fixed, added a test and published ex_cldr_dates_times version 2.6.2. Changelog entry is:

Bug Fixes

maennchen commented 3 years ago

@kipcole9 Hm, it still doesn't look solved:

** (Cldr.NoDefaultBackendError) No default :ex_cldr backend is configured
     code: assert pdf_binary = Quarantine.render_pdf(case, phase)
     stacktrace:
       (ex_cldr 2.18.2) lib/cldr/config/config.ex:328: Cldr.Config.default_backend/0
       (ex_cldr 2.18.2) lib/cldr.ex:434: Cldr.put_default_locale/1
       (ex_cldr 2.18.2) lib/cldr.ex:380: Cldr.default_locale/0
       (ex_cldr_dates_times 2.6.2) lib/cldr/date.ex:121: Cldr.Date.normalize_options/2
       (ex_cldr_dates_times 2.6.2) lib/cldr/date.ex:97: Cldr.Date.to_string/3
       (ex_cldr_dates_times 2.6.2) lib/cldr/date.ex:197: Cldr.Date.to_string!/3
       (acme 0.0.0-noversion) lib/acme/templates/confirmation.html.eex:102: Acme."confirmation.html"/1
kipcole9 commented 3 years ago

My apologies, that was sloppy. I had fixed it for Cldr.DateTime.to_string/3 but not for Cldr.Date.to_string/3 and Cldr.Time.to_string/3. Now done, with additional tests and published as ex_cldr_dates_times 2.6.3.

Bug Fixes

maennchen commented 3 years ago

@kipcole9 Tests pass again with 2.6.3, thanks a lot for the fast reaction. :heart: