From 1c917f67db20a8cad0ec1b5675cd310bc11fb30d Mon Sep 17 00:00:00 2001 From: Kip Cole Date: Wed, 24 Jul 2024 11:59:45 +1000 Subject: [PATCH] Interval formats may have variants --- CHANGELOG.md | 14 +++++++++++++- lib/cldr/backend/format.ex | 4 ++-- lib/cldr/date.ex | 21 ++++++++++++--------- lib/cldr/date_time.ex | 26 +++++++++++++++++--------- lib/cldr/format/date_time_format.ex | 12 +++++++++++- lib/cldr/interval/date.ex | 6 +++++- lib/cldr/interval/time.ex | 6 +++++- lib/cldr/time.ex | 14 ++++++++------ mix.exs | 2 ++ mix.lock | 12 ++++++------ mix/my_app_backend.ex | 2 +- 11 files changed, 82 insertions(+), 37 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 454a28d..a538cb2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,18 @@ **Note that `ex_cldr_dates_times` version 2.18.0 and later are supported on Elixir 1.12 and later only.** +## Cldr_Dates_Times v2.19.3 + +This is the changelog for Cldr_Dates_Times v2.19.3 released on _____, 2024. For older changelogs please consult the release tag on [GitHub](https://github.com/elixir-cldr/cldr_cldr_dates_times/tags) + +### Bug Fixes + +* Fix `Cldr.Time.available_formats/3` when the locale parameter is a binary. + +### Enhancements + +* Modify the `:prefer` option of `to_string/2` to take a list of preferences. Time formats may sometimes have a `:unicode` or `:ascii` preference. Date formats may have a `:default` or `:variant` preference. The `:prefer` option can no be specified with one or both of these options. + ## Cldr_Dates_Times v2.19.2 This is the changelog for Cldr_Dates_Times v2.19.2 released on July 9th, 2024. For older changelogs please consult the release tag on [GitHub](https://github.com/elixir-cldr/cldr_cldr_dates_times/tags) @@ -16,7 +28,7 @@ This is the changelog for Cldr_Dates_Times v2.19.1 released on July 8th, 2024. ### Bug Fixes -* Include `:skeleton_tokenizer.xrl` to the hex package definition. +* Include `:skeleton_tokenizer.xrl` to the hex package definition. ## Cldr_Dates_Times v2.19.0 diff --git a/lib/cldr/backend/format.ex b/lib/cldr/backend/format.ex index 96a5046..bfaaa25 100644 --- a/lib/cldr/backend/format.ex +++ b/lib/cldr/backend/format.ex @@ -446,7 +446,7 @@ defmodule Cldr.DateTime.Format.Backend do ## Examples: - iex> #{inspect(__MODULE__)}.time_available_formats "en" + iex> #{inspect(__MODULE__)}.time_available_formats :en """ @spec time_available_formats(Locale.locale_reference(), calendar) :: {:ok, formats} @@ -464,7 +464,7 @@ defmodule Cldr.DateTime.Format.Backend do def time_available_formats(locale_name, calendar) when is_binary(locale_name) do with {:ok, locale} <- unquote(backend).validate_locale(locale_name) do - date_available_formats(locale, calendar) + time_available_formats(locale, calendar) end end diff --git a/lib/cldr/date.ex b/lib/cldr/date.ex index d5607f9..62dac60 100644 --- a/lib/cldr/date.ex +++ b/lib/cldr/date.ex @@ -20,7 +20,7 @@ defmodule Cldr.Date do alias Cldr.Locale import Cldr.DateTime, - only: [resolve_plural_format: 4, apply_unicode_or_ascii_preference: 2] + only: [resolve_plural_format: 4, apply_preference: 2] @format_types [:short, :medium, :long, :full] @default_format_type :medium @@ -148,12 +148,13 @@ defmodule Cldr.Date do locale = options.locale format = options.format + prefer = List.wrap(options.prefer) with {:ok, locale} <- Cldr.validate_locale(locale, backend), {:ok, cldr_calendar} <- Cldr.DateTime.type_from_calendar(calendar), {:ok, _} <- Cldr.Number.validate_number_system(locale, number_system, backend), {:ok, format} <- find_format(date, format, locale, cldr_calendar, backend), - {:ok, format} <- apply_unicode_or_ascii_preference(format, options.prefer), + {:ok, format} <- apply_preference(format, prefer), {:ok, format_string} <- resolve_plural_format(format, date, backend, options) do format_backend.format(date, format_string, locale, options) end @@ -260,18 +261,19 @@ defmodule Cldr.Date do defp normalize_options(date, backend, []) do {locale, _backend} = Cldr.locale_and_backend_from(nil, backend) number_system = Cldr.Number.System.number_system_from_locale(locale, backend) - format = format_from_options(date, nil, @default_format_type) + prefer = List.wrap(@default_prefer) + format = format_from_options(date, nil, @default_format_type, prefer) - %{locale: locale, number_system: number_system, format: format, prefer: @default_prefer} + %{locale: locale, number_system: number_system, format: format, prefer: prefer} end defp normalize_options(date, backend, options) do {locale, _backend} = Cldr.locale_and_backend_from(options[:locale], backend) locale_number_system = Cldr.Number.System.number_system_from_locale(locale, backend) number_system = Keyword.get(options, :number_system, locale_number_system) - prefer = options[:prefer] || @default_prefer + prefer = Keyword.get(options, :prefer, @default_prefer) |> List.wrap() format_option = options[:date_format] || options[:format] || options[:style] - format = format_from_options(date, format_option, @default_format_type) + format = format_from_options(date, format_option, @default_format_type, prefer) options |> Keyword.put(:locale, locale) @@ -283,17 +285,18 @@ defmodule Cldr.Date do end # Full date, no option, use the default format - defp format_from_options(date, nil, default_format) when is_full_date(date) do + defp format_from_options(date, nil, default_format, _prefer) when is_full_date(date) do default_format end # Partial date, no option, derive the format from the date - defp format_from_options(date, nil, _default_format) do + defp format_from_options(date, nil, _default_format, _prefer) do derive_format_id(date) end # If a format is requested, use it - defp format_from_options(_date, format, _default_format) do + defp format_from_options(_time, format, _default_format, prefer) do + {:ok, format} = apply_preference(format, prefer) format end diff --git a/lib/cldr/date_time.ex b/lib/cldr/date_time.ex index ea9b58f..3724143 100644 --- a/lib/cldr/date_time.ex +++ b/lib/cldr/date_time.ex @@ -211,7 +211,7 @@ defmodule Cldr.DateTime do {:ok, _} <- Cldr.Number.validate_number_system(locale, options.number_system, backend), {:ok, format, options} <- find_format(datetime, options.format, locale, cldr_calendar, backend, options), - {:ok, format} <- apply_unicode_or_ascii_preference(format, options.prefer), + {:ok, format} <- apply_preference(format, options.prefer), {:ok, format_string} <- resolve_plural_format(format, datetime, backend, options) do format_backend.format(datetime, format_string, locale, options) end @@ -486,7 +486,7 @@ defmodule Cldr.DateTime do date_format: date_format, time_format: time_format, style: @default_style, - prefer: @default_prefer + prefer: [@default_prefer] } {:ok, datetime, options} @@ -499,7 +499,7 @@ defmodule Cldr.DateTime do datetime = Map.put_new(datetime, :calendar, calendar) style = options[:style] || @default_style - prefer = options[:prefer] || @default_prefer + prefer = Keyword.get(options, :prefer, @default_prefer) |> List.wrap() format = options[:format] date_format = options[:date_format] @@ -790,7 +790,7 @@ defmodule Cldr.DateTime do defp preferred_format(formats, format, prefer) do case Map.fetch(formats, format) do {:ok, format} -> - apply_unicode_or_ascii_preference(format, prefer) + apply_preference(format, prefer) :error -> {:error, @@ -801,15 +801,23 @@ defmodule Cldr.DateTime do end @doc false - def apply_unicode_or_ascii_preference(%{unicode: _unicode, ascii: ascii}, :ascii) do - {:ok, ascii} + def apply_preference(%{unicode: unicode, ascii: ascii}, preference) do + if :ascii in preference do + {:ok, ascii} + else + {:ok, unicode} + end end - def apply_unicode_or_ascii_preference(%{unicode: unicode, ascii: _ascii}, _) do - {:ok, unicode} + def apply_preference(%{default: default, variant: variant}, preference) do + if :variant in preference do + {:ok, variant} + else + {:ok, default} + end end - def apply_unicode_or_ascii_preference(format, _) do + def apply_preference(format, _) do {:ok, format} end diff --git a/lib/cldr/format/date_time_format.ex b/lib/cldr/format/date_time_format.ex index 41376ad..6598640 100644 --- a/lib/cldr/format/date_time_format.ex +++ b/lib/cldr/format/date_time_format.ex @@ -46,7 +46,6 @@ defmodule Cldr.DateTime.Format do def format_list(config) do locale_names = Cldr.Locale.Loader.known_locale_names(config) backend = config.backend - ((known_formats(&all_date_formats(&1, backend), locale_names) ++ known_formats(&all_time_formats(&1, backend), locale_names) ++ known_formats(&all_date_time_formats(&1, backend), locale_names) ++ @@ -69,6 +68,7 @@ defmodule Cldr.DateTime.Format do defp precompile_interval_formats(config) do config.precompile_interval_formats |> Enum.flat_map(&split_interval!/1) + |> List.flatten() end @doc """ @@ -622,6 +622,10 @@ defmodule Cldr.DateTime.Format do |> Map.values() |> Enum.filter(&is_map/1) |> Enum.flat_map(&Map.values/1) + |> Enum.map(fn + %{default: default, variant: variant} -> [default, variant] + other -> other + end) end) |> List.flatten() |> Enum.uniq() @@ -937,6 +941,12 @@ defmodule Cldr.DateTime.Format do {Cldr.DateTime.IntervalFormatError, "Invalid datetime interval format #{inspect(left)}"}} end + # Handle default/variant maps + + defp do_split_interval(%{default: default, variant: variant}, _acc, _left) do + %{default: do_split_interval(default, [], ""), variant: do_split_interval(variant, [], "")} + end + # Quoted strings pass through. This assumes the quotes # are correctly closed. diff --git a/lib/cldr/interval/date.ex b/lib/cldr/interval/date.ex index 415e7d1..b1c84f2 100644 --- a/lib/cldr/interval/date.ex +++ b/lib/cldr/interval/date.ex @@ -10,6 +10,7 @@ defmodule Cldr.Date.Interval do """ alias Cldr.DateTime.Format import Cldr.Calendar, only: [date: 0] + import Cldr.DateTime, only: [apply_preference: 2] # Date styles not defined # by a grouping but can still @@ -64,6 +65,7 @@ defmodule Cldr.Date.Interval do @default_format :medium @default_style :date + @default_prefer :default def styles do @style_map @@ -384,6 +386,7 @@ defmodule Cldr.Date.Interval do format = Keyword.get(options, :format, @default_format) locale_number_system = Cldr.Number.System.number_system_from_locale(locale, backend) number_system = Keyword.get(options, :number_system, locale_number_system) + prefer = Keyword.get(options, :prefer, @default_prefer) |> List.wrap() options = options @@ -396,7 +399,8 @@ defmodule Cldr.Date.Interval do {:ok, _} <- Cldr.Number.validate_number_system(locale, number_system, backend), {:ok, calendar} <- Cldr.Calendar.validate_calendar(from.calendar), {:ok, formats} <- Format.interval_formats(locale, calendar.cldr_calendar_type(), backend), - {:ok, [left, right]} <- resolve_format(from, to, formats, options), + {:ok, format} <- resolve_format(from, to, formats, options), + {:ok, [left, right]} <- apply_preference(format, prefer), {:ok, left_format} <- formatter.format(from, left, locale, options), {:ok, right_format} <- formatter.format(to, right, locale, options) do {:ok, left_format <> right_format} diff --git a/lib/cldr/interval/time.ex b/lib/cldr/interval/time.ex index ff15d37..3658586 100644 --- a/lib/cldr/interval/time.ex +++ b/lib/cldr/interval/time.ex @@ -10,6 +10,7 @@ defmodule Cldr.Time.Interval do """ alias Cldr.DateTime.Format + import Cldr.DateTime, only: [apply_preference: 2] import Cldr.Date.Interval, only: [ @@ -78,6 +79,7 @@ defmodule Cldr.Time.Interval do @default_format :medium @default_style :time + @default_prefer :default def styles do @style_map @@ -240,6 +242,7 @@ defmodule Cldr.Time.Interval do format = Keyword.get(options, :format, @default_format) locale_number_system = Cldr.Number.System.number_system_from_locale(locale, backend) number_system = Keyword.get(options, :number_system, locale_number_system) + prefer = Keyword.get(options, :prefer, @default_prefer) options = options @@ -251,7 +254,8 @@ defmodule Cldr.Time.Interval do {:ok, _} <- Cldr.Number.validate_number_system(locale, number_system, backend), {:ok, calendar} <- Cldr.Calendar.validate_calendar(from.calendar), {:ok, formats} <- Format.interval_formats(locale, calendar.cldr_calendar_type(), backend), - {:ok, [left, right]} <- resolve_format(from, to, formats, locale, options), + {:ok, format} <- resolve_format(from, to, formats, locale, options), + {:ok, [left, right]} <- apply_preference(format, prefer), {:ok, left_format} <- formatter.format(from, left, locale, options), {:ok, right_format} <- formatter.format(to, right, locale, options) do {:ok, left_format <> right_format} diff --git a/lib/cldr/time.ex b/lib/cldr/time.ex index 2bd7c58..8137f62 100644 --- a/lib/cldr/time.ex +++ b/lib/cldr/time.ex @@ -22,7 +22,7 @@ defmodule Cldr.Time do alias Cldr.Locale import Cldr.DateTime, - only: [resolve_plural_format: 4, apply_unicode_or_ascii_preference: 2] + only: [resolve_plural_format: 4, apply_preference: 2] @format_types [:short, :medium, :long, :full] @default_format_type :medium @@ -155,12 +155,13 @@ defmodule Cldr.Time do locale = options.locale format = options.format + prefer = List.wrap(options.prefer) with {:ok, locale} <- Cldr.validate_locale(locale, backend), {:ok, cldr_calendar} <- Cldr.DateTime.type_from_calendar(calendar), {:ok, _} <- Cldr.Number.validate_number_system(locale, number_system, backend), {:ok, format} <- find_format(time, format, locale, cldr_calendar, backend), - {:ok, format} <- apply_unicode_or_ascii_preference(format, options.prefer), + {:ok, format} <- apply_preference(format, prefer), {:ok, format_string} <- resolve_plural_format(format, time, backend, options) do format_backend.format(time, format_string, locale, options) end @@ -265,16 +266,17 @@ defmodule Cldr.Time do defp normalize_options(time, backend, []) do {locale, _backend} = Cldr.locale_and_backend_from(nil, backend) number_system = Cldr.Number.System.number_system_from_locale(locale, backend) - format = format_from_options(time, nil, @default_format_type, @default_prefer) + default_prefer = List.wrap(@default_prefer) + format = format_from_options(time, nil, @default_format_type, default_prefer) - %{locale: locale, number_system: number_system, format: format, prefer: @default_prefer} + %{locale: locale, number_system: number_system, format: format, prefer: default_prefer} end defp normalize_options(time, backend, options) do {locale, _backend} = Cldr.locale_and_backend_from(options[:locale], backend) locale_number_system = Cldr.Number.System.number_system_from_locale(locale, backend) number_system = Keyword.get(options, :number_system, locale_number_system) - prefer = Keyword.get(options, :prefer, @default_prefer) + prefer = Keyword.get(options, :prefer, @default_prefer) |> List.wrap() format_option = options[:time_format] || options[:format] || options[:style] format = format_from_options(time, format_option, @default_format_type, prefer) @@ -299,7 +301,7 @@ defmodule Cldr.Time do # If a format is requested, use it defp format_from_options(_time, format, _default_format, prefer) do - {:ok, format} = apply_unicode_or_ascii_preference(format, prefer) + {:ok, format} = apply_preference(format, prefer) format end diff --git a/mix.exs b/mix.exs index 7b3c625..0ffd511 100644 --- a/mix.exs +++ b/mix.exs @@ -70,6 +70,8 @@ defmodule Cldr.DatesTimes.Mixfile do defp deps do [ + {:ex_cldr, path: "../cldr", override: true}, + {:ex_cldr_calendars, "~> 1.25"}, {:calendar_interval, "~> 0.2", optional: true}, {:ex_doc, "~> 0.25", optional: true, only: [:dev, :release], runtime: false}, diff --git a/mix.lock b/mix.lock index 9d77368..b75acb6 100644 --- a/mix.lock +++ b/mix.lock @@ -1,29 +1,29 @@ %{ "benchee": {:hex, :benchee, "1.3.1", "c786e6a76321121a44229dde3988fc772bca73ea75170a73fd5f4ddf1af95ccf", [:mix], [{:deep_merge, "~> 1.0", [hex: :deep_merge, repo: "hexpm", optional: false]}, {:statistex, "~> 1.0", [hex: :statistex, repo: "hexpm", optional: false]}, {:table, "~> 0.1.0", [hex: :table, repo: "hexpm", optional: true]}], "hexpm", "76224c58ea1d0391c8309a8ecbfe27d71062878f59bd41a390266bf4ac1cc56d"}, "calendar_interval": {:hex, :calendar_interval, "0.2.0", "2b253b1e37ee1d4344639a3cbfb12abd0e996e4a8181537eb33c3e93fdfaffd9", [:mix], [], "hexpm", "c13d5e0108e61808a38f622987e1c5e881d96d28945213d3efe6dd06c28ba7b0"}, - "cldr_utils": {:hex, :cldr_utils, "2.27.0", "a75d5cdaaf6b7432eb10f547e6abe635c94746985c5b78e35bbbd08b16473b6c", [:mix], [{:castore, "~> 0.1 or ~> 1.0", [hex: :castore, repo: "hexpm", optional: true]}, {:certifi, "~> 2.5", [hex: :certifi, repo: "hexpm", optional: true]}, {:decimal, "~> 1.9 or ~> 2.0", [hex: :decimal, repo: "hexpm", optional: false]}], "hexpm", "516f601e28da10b8f1f3af565321c4e3da3b898a0b50a5e5be425eff76d587e1"}, + "cldr_utils": {:hex, :cldr_utils, "2.28.0", "ce309d11b79fc13e1f22f808b5e3c1647102b01b11734ca8cb0296ca6d406fe4", [:mix], [{:castore, "~> 0.1 or ~> 1.0", [hex: :castore, repo: "hexpm", optional: true]}, {:certifi, "~> 2.5", [hex: :certifi, repo: "hexpm", optional: true]}, {:decimal, "~> 1.9 or ~> 2.0", [hex: :decimal, repo: "hexpm", optional: false]}], "hexpm", "e7ac4bcea0fdbc11b5295ef30dd7b18d0922512399361af06a97198e57d23742"}, "coerce": {:hex, :coerce, "1.0.1", "211c27386315dc2894ac11bc1f413a0e38505d808153367bd5c6e75a4003d096", [:mix], [], "hexpm", "b44a691700f7a1a15b4b7e2ff1fa30bebd669929ac8aa43cffe9e2f8bf051cf1"}, "decimal": {:hex, :decimal, "2.1.1", "5611dca5d4b2c3dd497dec8f68751f1f1a54755e8ed2a966c2633cf885973ad6", [:mix], [], "hexpm", "53cfe5f497ed0e7771ae1a475575603d77425099ba5faef9394932b35020ffcc"}, "deep_merge": {:hex, :deep_merge, "1.0.0", "b4aa1a0d1acac393bdf38b2291af38cb1d4a52806cf7a4906f718e1feb5ee961", [:mix], [], "hexpm", "ce708e5f094b9cd4e8f2be4f00d2f4250c4095be93f8cd6d018c753894885430"}, "dialyxir": {:hex, :dialyxir, "1.4.3", "edd0124f358f0b9e95bfe53a9fcf806d615d8f838e2202a9f430d59566b6b53b", [:mix], [{:erlex, ">= 0.2.6", [hex: :erlex, repo: "hexpm", optional: false]}], "hexpm", "bf2cfb75cd5c5006bec30141b131663299c661a864ec7fbbc72dfa557487a986"}, "digital_token": {:hex, :digital_token, "0.6.0", "13e6de581f0b1f6c686f7c7d12ab11a84a7b22fa79adeb4b50eec1a2d278d258", [:mix], [{:cldr_utils, "~> 2.17", [hex: :cldr_utils, repo: "hexpm", optional: false]}, {:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: true]}], "hexpm", "2455d626e7c61a128b02a4a8caddb092548c3eb613ac6f6a85e4cbb6caddc4d1"}, "earmark": {:hex, :earmark, "1.4.14", "d04572cef64dd92726a97d92d714e38d6e130b024ea1b3f8a56e7de66ec04e50", [:mix], [{:earmark_parser, ">= 1.4.12", [hex: :earmark_parser, repo: "hexpm", optional: false]}], "hexpm", "df338b8b1852ee425180b276c56c6941cb12220e04fe8718fe4acbdd35fd699f"}, - "earmark_parser": {:hex, :earmark_parser, "1.4.39", "424642f8335b05bb9eb611aa1564c148a8ee35c9c8a8bba6e129d51a3e3c6769", [:mix], [], "hexpm", "06553a88d1f1846da9ef066b87b57c6f605552cfbe40d20bd8d59cc6bde41944"}, + "earmark_parser": {:hex, :earmark_parser, "1.4.41", "ab34711c9dc6212dda44fcd20ecb87ac3f3fce6f0ca2f28d4a00e4154f8cd599", [:mix], [], "hexpm", "a81a04c7e34b6617c2792e291b5a2e57ab316365c2644ddc553bb9ed863ebefa"}, "erlex": {:hex, :erlex, "0.2.7", "810e8725f96ab74d17aac676e748627a07bc87eb950d2b83acd29dc047a30595", [:mix], [], "hexpm", "3ed95f79d1a844c3f6bf0cea61e0d5612a42ce56da9c03f01df538685365efb0"}, "ex_cldr": {:hex, :ex_cldr, "2.39.2", "4a3a77797da8f900369822ea9353adfa035a5bbbbfff09b2d3d1b6fa461768e3", [:mix], [{:cldr_utils, "~> 2.25", [hex: :cldr_utils, repo: "hexpm", optional: false]}, {:decimal, "~> 1.6 or ~> 2.0", [hex: :decimal, repo: "hexpm", optional: false]}, {:gettext, "~> 0.19", [hex: :gettext, repo: "hexpm", optional: true]}, {:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: true]}, {:nimble_parsec, "~> 0.5 or ~> 1.0", [hex: :nimble_parsec, repo: "hexpm", optional: true]}], "hexpm", "02fd8913ef28d1b2a4190fd8016c2dec1f2291c9ce56c17d7649848c0261a6eb"}, - "ex_cldr_calendars": {:hex, :ex_cldr_calendars, "1.25.0", "2d2e3e08e0b557bd20dd05ea5ad85da3b64390aa6467ba951397768717c8af8d", [:mix], [{:calendar_interval, "~> 0.2", [hex: :calendar_interval, repo: "hexpm", optional: true]}, {:ex_cldr_lists, "~> 2.10", [hex: :ex_cldr_lists, repo: "hexpm", optional: true]}, {:ex_cldr_numbers, "~> 2.31", [hex: :ex_cldr_numbers, repo: "hexpm", optional: false]}, {:ex_cldr_units, "~> 3.16", [hex: :ex_cldr_units, repo: "hexpm", optional: true]}, {:ex_doc, "~> 0.21", [hex: :ex_doc, repo: "hexpm", optional: true]}, {:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: false]}], "hexpm", "c3cd41c5d7978cbfe5f103a8a5c5646beb98b0387c5c4df2ff62356c6f48d252"}, + "ex_cldr_calendars": {:hex, :ex_cldr_calendars, "1.25.2", "7c6c84503a52edb512b09d62ad1a2946996b47dbfe29211a99c3a3ffb6043991", [:mix], [{:calendar_interval, "~> 0.2", [hex: :calendar_interval, repo: "hexpm", optional: true]}, {:ex_cldr_lists, "~> 2.10", [hex: :ex_cldr_lists, repo: "hexpm", optional: true]}, {:ex_cldr_numbers, "~> 2.31", [hex: :ex_cldr_numbers, repo: "hexpm", optional: false]}, {:ex_cldr_units, "~> 3.16", [hex: :ex_cldr_units, repo: "hexpm", optional: true]}, {:ex_doc, "~> 0.21", [hex: :ex_doc, repo: "hexpm", optional: true]}, {:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: false]}], "hexpm", "a04b0a189bcf38bad919b03fd586938b75454f3a4d56d049b7159bb1cadd7843"}, "ex_cldr_currencies": {:hex, :ex_cldr_currencies, "2.16.1", "29317f533cb5ec046d04523256cca4090291e9157028f28731395149b06ff8b2", [:mix], [{:ex_cldr, "~> 2.38", [hex: :ex_cldr, repo: "hexpm", optional: false]}, {:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: true]}], "hexpm", "095d5e973bf0ee066dd1153990d10cb6fa6d8ff0e028295bdce7a7821c70a0e4"}, "ex_cldr_numbers": {:hex, :ex_cldr_numbers, "2.33.1", "49dc6e77e6d9ad22660aaa2480a7408ad3aedfbe517e4e83e5fe3a7bf5345770", [:mix], [{:decimal, "~> 1.6 or ~> 2.0", [hex: :decimal, repo: "hexpm", optional: false]}, {:digital_token, "~> 0.3 or ~> 1.0", [hex: :digital_token, repo: "hexpm", optional: false]}, {:ex_cldr, "~> 2.38", [hex: :ex_cldr, repo: "hexpm", optional: false]}, {:ex_cldr_currencies, "~> 2.16", [hex: :ex_cldr_currencies, repo: "hexpm", optional: false]}, {:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: true]}], "hexpm", "c003bfaa3fdee6bab5195f128b94038c2ce1cf4879a759eef431dd075d9a5dac"}, - "ex_doc": {:hex, :ex_doc, "0.34.1", "9751a0419bc15bc7580c73fde506b17b07f6402a1e5243be9e0f05a68c723368", [:mix], [{:earmark_parser, "~> 1.4.39", [hex: :earmark_parser, repo: "hexpm", optional: false]}, {:makeup_c, ">= 0.1.0", [hex: :makeup_c, repo: "hexpm", optional: true]}, {:makeup_elixir, "~> 0.14 or ~> 1.0", [hex: :makeup_elixir, repo: "hexpm", optional: false]}, {:makeup_erlang, "~> 0.1 or ~> 1.0", [hex: :makeup_erlang, repo: "hexpm", optional: false]}, {:makeup_html, ">= 0.1.0", [hex: :makeup_html, repo: "hexpm", optional: true]}], "hexpm", "d441f1a86a235f59088978eff870de2e815e290e44a8bd976fe5d64470a4c9d2"}, + "ex_doc": {:hex, :ex_doc, "0.34.2", "13eedf3844ccdce25cfd837b99bea9ad92c4e511233199440488d217c92571e8", [:mix], [{:earmark_parser, "~> 1.4.39", [hex: :earmark_parser, repo: "hexpm", optional: false]}, {:makeup_c, ">= 0.1.0", [hex: :makeup_c, repo: "hexpm", optional: true]}, {:makeup_elixir, "~> 0.14 or ~> 1.0", [hex: :makeup_elixir, repo: "hexpm", optional: false]}, {:makeup_erlang, "~> 0.1 or ~> 1.0", [hex: :makeup_erlang, repo: "hexpm", optional: false]}, {:makeup_html, ">= 0.1.0", [hex: :makeup_html, repo: "hexpm", optional: true]}], "hexpm", "5ce5f16b41208a50106afed3de6a2ed34f4acfd65715b82a0b84b49d995f95c1"}, "exprintf": {:hex, :exprintf, "0.2.1", "b7e895dfb00520cfb7fc1671303b63b37dc3897c59be7cbf1ae62f766a8a0314", [:mix], [], "hexpm", "20a0e8c880be90e56a77fcc82533c5d60c643915c7ce0cc8aa1e06ed6001da28"}, "exprof": {:hex, :exprof, "0.2.4", "13ddc0575a6d24b52e7c6809d2a46e9ad63a4dd179628698cdbb6c1f6e497c98", [:mix], [{:exprintf, "~> 0.2", [hex: :exprintf, repo: "hexpm", optional: false]}], "hexpm", "0884bcb66afc421c75d749156acbb99034cc7db6d3b116c32e36f32551106957"}, "jason": {:hex, :jason, "1.4.3", "d3f984eeb96fe53b85d20e0b049f03e57d075b5acda3ac8d465c969a2536c17b", [:mix], [{:decimal, "~> 1.0 or ~> 2.0", [hex: :decimal, repo: "hexpm", optional: true]}], "hexpm", "9a90e868927f7c777689baa16d86f4d0e086d968db5c05d917ccff6d443e58a3"}, "makeup": {:hex, :makeup, "1.1.2", "9ba8837913bdf757787e71c1581c21f9d2455f4dd04cfca785c70bbfff1a76a3", [:mix], [{:nimble_parsec, "~> 1.2.2 or ~> 1.3", [hex: :nimble_parsec, repo: "hexpm", optional: false]}], "hexpm", "cce1566b81fbcbd21eca8ffe808f33b221f9eee2cbc7a1706fc3da9ff18e6cac"}, "makeup_elixir": {:hex, :makeup_elixir, "0.16.2", "627e84b8e8bf22e60a2579dad15067c755531fea049ae26ef1020cad58fe9578", [:mix], [{:makeup, "~> 1.0", [hex: :makeup, repo: "hexpm", optional: false]}, {:nimble_parsec, "~> 1.2.3 or ~> 1.3", [hex: :nimble_parsec, repo: "hexpm", optional: false]}], "hexpm", "41193978704763f6bbe6cc2758b84909e62984c7752b3784bd3c218bb341706b"}, - "makeup_erlang": {:hex, :makeup_erlang, "1.0.0", "6f0eff9c9c489f26b69b61440bf1b238d95badae49adac77973cbacae87e3c2e", [:mix], [{:makeup, "~> 1.0", [hex: :makeup, repo: "hexpm", optional: false]}], "hexpm", "ea7a9307de9d1548d2a72d299058d1fd2339e3d398560a0e46c27dab4891e4d2"}, + "makeup_erlang": {:hex, :makeup_erlang, "1.0.1", "c7f58c120b2b5aa5fd80d540a89fdf866ed42f1f3994e4fe189abebeab610839", [:mix], [{:makeup, "~> 1.0", [hex: :makeup, repo: "hexpm", optional: false]}], "hexpm", "8a89a1eeccc2d798d6ea15496a6e4870b75e014d1af514b1b71fa33134f57814"}, "nimble_parsec": {:hex, :nimble_parsec, "1.4.0", "51f9b613ea62cfa97b25ccc2c1b4216e81df970acd8e16e8d1bdc58fef21370d", [:mix], [], "hexpm", "9c565862810fb383e9838c1dd2d7d2c437b3d13b267414ba6af33e50d2d1cf28"}, "numbers": {:hex, :numbers, "5.2.4", "f123d5bb7f6acc366f8f445e10a32bd403c8469bdbce8ce049e1f0972b607080", [:mix], [{:coerce, "~> 1.0", [hex: :coerce, repo: "hexpm", optional: false]}, {:decimal, "~> 1.9 or ~> 2.0", [hex: :decimal, repo: "hexpm", optional: true]}], "hexpm", "eeccf5c61d5f4922198395bf87a465b6f980b8b862dd22d28198c5e6fab38582"}, "ratio": {:hex, :ratio, "2.4.2", "c8518f3536d49b1b00d88dd20d49f8b11abb7819638093314a6348139f14f9f9", [:mix], [{:decimal, "~> 1.6 or ~> 2.0", [hex: :decimal, repo: "hexpm", optional: true]}, {:numbers, "~> 5.2.0", [hex: :numbers, repo: "hexpm", optional: false]}], "hexpm", "441ef6f73172a3503de65ccf1769030997b0d533b1039422f1e5e0e0b4cbf89e"}, "statistex": {:hex, :statistex, "1.0.0", "f3dc93f3c0c6c92e5f291704cf62b99b553253d7969e9a5fa713e5481cd858a5", [:mix], [], "hexpm", "ff9d8bee7035028ab4742ff52fc80a2aa35cece833cf5319009b52f1b5a86c27"}, - "tz": {:hex, :tz, "0.26.5", "bfe8efa345670f90351c5c31d22455d0307c5d9895fbdede7deeb215a7b60dbe", [:mix], [{:castore, "~> 0.1 or ~> 1.0", [hex: :castore, repo: "hexpm", optional: true]}, {:mint, "~> 1.5", [hex: :mint, repo: "hexpm", optional: true]}], "hexpm", "c4f9392d710582c7108b6b8c635f4981120ec4b2072adbd242290fc842338183"}, + "tz": {:hex, :tz, "0.26.6", "4d46178dd5bc4d2c1e78c9affcc3fd46764e29cd2a148c06666edb83cb18629f", [:mix], [{:castore, "~> 0.1 or ~> 1.0", [hex: :castore, repo: "hexpm", optional: true]}, {:mint, "~> 1.6", [hex: :mint, repo: "hexpm", optional: true]}], "hexpm", "9ca97ea48b412f2404740867f6c321ee8ce112602035bb79b0b90c9c03174652"}, } diff --git a/mix/my_app_backend.ex b/mix/my_app_backend.ex index 092497f..de478c8 100644 --- a/mix/my_app_backend.ex +++ b/mix/my_app_backend.ex @@ -1,6 +1,6 @@ defmodule MyApp.Cldr do use Cldr, - locales: ["en", "fr", "af", "ja", "de", "pl", "th", "fa", "es", "da"], + locales: ["en", "fr", "af", "ja", "de", "pl", "th", "fa", "es", "da", "en-CA"], providers: [Cldr.Number, Cldr.Calendar, Cldr.DateTime], precompile_number_formats: ["#,##0"], precompile_transliterations: [{:latn, :thai}]