Skip to content

Commit

Permalink
Fix :default_currency_format setting
Browse files Browse the repository at this point in the history
  • Loading branch information
kipcole9 committed Mar 7, 2023
1 parent f393b26 commit 856f3f4
Show file tree
Hide file tree
Showing 4 changed files with 42 additions and 2 deletions.
10 changes: 10 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,15 @@
# Changelog

## Cldr v2.35.1

This is the changelog for Cldr v2.35.1 released on March 7th, 2023. For older changelogs please consult the release tag on [GitHub](https://github.com/elixir-cldr/cldr/tags)

** Note that `ex_cldr` version 2.33.0 and later are supported on Elixir 1.11 and later only.**

### Bug Fixes

* Fix bug that prevented setting `:default_currency_format` that slipped into the release (tests added).

## Cldr v2.35.0

This is the changelog for Cldr v2.35.0 released on March 7th, 2023. For older changelogs please consult the release tag on [GitHub](https://github.com/elixir-cldr/cldr/tags)
Expand Down
2 changes: 1 addition & 1 deletion lib/cldr/config/config.ex
Original file line number Diff line number Diff line change
Expand Up @@ -2378,7 +2378,7 @@ defmodule Cldr.Config do
config
|> Map.put(:default_locale, default_locale_name(config))
|> Map.put(:data_dir, client_data_dir(config))
|> Map.put(:default_currency_format, nil)
|> Map.put_new(:default_currency_format, nil)
|> fix_suppress_warnings_typo()
|> merge_locales_with_default()
|> remove_gettext_only_locales()
Expand Down
2 changes: 1 addition & 1 deletion mix.exs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
defmodule Cldr.Mixfile do
use Mix.Project

@version "2.35.0"
@version "2.35.1"

def project do
[
Expand Down
30 changes: 30 additions & 0 deletions test/config_locales_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -117,4 +117,34 @@ defmodule Cldr.Config.Test do
end
end) =~ "The option :supress_warnings has been deprecated and replaced with :suppress_warnings"
end

test ":default_currency_format is configured as :currency" do
capture_io(fn ->
defmodule DefaultCurrencyFormat do
use Cldr,
default_locale: "en",
providers: [Cldr.Currency],
suppress_warnings: false,
default_currency_format: :currency
end
end)

assert apply(Cldr.Config.Test.DefaultCurrencyFormat, :__cldr__, [:config]).default_currency_format ==
:currency
end

test ":default_currency_format is configured as :accounting" do
capture_io(fn ->
defmodule DefaultAccountingFormat do
use Cldr,
default_locale: "en",
providers: [Cldr.Currency],
suppress_warnings: false,
default_currency_format: :accounting
end
end)

assert apply(Cldr.Config.Test.DefaultAccountingFormat, :__cldr__, [:config]).default_currency_format ==
:accounting
end
end

0 comments on commit 856f3f4

Please sign in to comment.