elixir-cldr / cldr

Elixir implementation of CLDR/ICU

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

warning: validate_locale/1 is undefined

drselump14 opened this issue · comments

Hi, thanks for making this awesome library.

I got below warning in my Phoenix app recently,

warning: DesignSync.Cldr.validate_locale/1 is undefined or private

my DesignSync.Cldr module is like this

defmodule DesignSync.Cldr do
  @moduledoc """
  Cldr module
  """

  use Cldr,
    otp_app: :design_sync,
    gettext: DesignSyncWeb.Gettext,
    providers: [Cldr.LocaleDisplay]
end

I have zero ideas why this warning appears. Is there something I missed here?
Any help would be appreciated

That's very surprising to me too and apologies for the poor experience. I created a new app with your configuration (thanks for posting that) and didn't have the same issue as you are seeing:

Compiling 1 file (.ex)
Generating DesignSync.Cldr for 3 locales named [:en, :"en-001", :und] with a default locale named :"en-001"
Generated design_sync app
Interactive Elixir (1.14.2) - press Ctrl+C to exit (type h() ENTER for help)
iex(1)> DesignSync.Cldr.validate_locale(:en)
{:ok, #Cldr.LanguageTag<en [validated]>}

These are the versions I tested with, would you mind checking what versions you are running with?

kip@Kips-MBP design % mix hex.outdated
Dependency              Current  Latest  Status
ex_cldr                 2.36.0   2.36.0  Up-to-date
ex_cldr_locale_display  1.3.1    1.3.1   Up-to-date
jason                   1.4.0    1.4.0   Up-to-date

Apart from versions (which would be a surprise, MyApp.Cldr.validate_locale/1 has been around a long long time!) may I also ask you to paste the results of DesignSync.module_info(:functions)? You should see something like this (validate_locale/1 is towards the end):

iex(1)> DesignSync.Cldr.module_info(:functions)
[
  __info__: 1,
  available_locale_name?: 1,
  known_calendars: 0,
  known_currencies: 0,
  known_number_systems: 0,
  known_territories: 0,
  validate_calendar: 1,
  validate_currency: 1,
  validate_number_system: 1,
  validate_territory: 1,
  __cldr__: 1,
  default_locale: 0,
  default_territory: 0,
  do_validate_locale: 1,
  ellipsis: 1,
  ellipsis: 2,
  ellipsis: 4,
  ellipsis_chars: 1,
  get_locale: 0,
  known_cldr_locale: 2,
  known_cldr_territory: 1,
  known_gettext_locale_name: 1,
  known_gettext_locale_name?: 1,
  known_gettext_locale_names: 0,
  known_locale_name: 1,
  known_locale_name?: 1,
  known_locale_names: 0,
  known_number_system_types: 0,
  known_rbnf_locale_name: 1,
  known_rbnf_locale_name?: 1,
  known_rbnf_locale_names: 0,
  lenient_parse_map: 2,
  normalize_lenient_parse: 2,
  normalize_lenient_parse: 3,
  put_locale: 1,
  quote: 1,
  quote: 2,
  quote_marks_for: 1,
  unknown_locale_names: 0,
  validate_locale: 1,
  validate_number_system_type: 1,
  with_locale: 2,
  module_info: 0,
  module_info: 1,
  "-normalize_lenient_parse/3-fun-0-": 2,
  "-inlined-__cldr__/1-": 1,
  "-inlined-__info__/1-": 1,
  "-inlined-ellipsis/2-": 2,
  "-inlined-ellipsis/4-": 4,
  "-inlined-ellipsis_chars/1-": 1,
  ...
]

If none of that provides a clue then I can only suggest either mix compile --force or nuking the _build folder.

@kipcole9 Thanks for the reply and the detailed explanation. I appreciated it.
You're right. After nuking the _build folder, everything returns to normal.
Thank you so much