Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bump ex_cldr_numbers from 2.28.0 to 2.29.0 #1848

Merged
merged 1 commit into from
Jan 21, 2023

Conversation

dependabot[bot]
Copy link
Contributor

@dependabot dependabot bot commented on behalf of github Jan 18, 2023

⚠️ Dependabot is rebasing this PR ⚠️

Rebasing might not happen immediately, so don't worry if this takes some time.

Note: if you make any changes to this PR yourself, they will take precedence over the rebase.


Bumps ex_cldr_numbers from 2.28.0 to 2.29.0.

Release notes

Sourced from ex_cldr_numbers's releases.

Cldr Numbers version 2.29.0

Behavior change

  • In prior releases formatting a number as format: :currency would derive the currency code from the locale if no :currency_code was provided. This is no longer the case. As of CLDR42 a format :currency_no_symbol is defined to allow formatting of the number without an associated symbol. Now when format: :currency is passed without a :currency_code option, the format is changed to format: :currency_no_symbol. To retain the existing behaviour, pass currency_code: Cldr.Currency.currency_from_locale(locale) as an option.

  • In prior releases the currency format (:currency or :accounting) would be overriden by any choice expressed in the locale. That is no longer the case from this release. To retain the existing behaviour, pass format: Cldr.Currency.currency_format_from_locale(locale) as an option.

Enhancements

  • Adds an option :wrapper to Cldr.Number.to_string/2. The argument is a 2-arity function that receives the parameters string and tag where tag is one of :number, :currency_symbol, :currency_space, :literal, :quote, :percent, :permille, :minus or :plus. The function must return a string or a "safe string" such as that returned by Phoenix.HTML.Tag.content_tag/3. The function can be used to wrap format elements in HTML or other tags. Thanks to @​rubas for the motivation and review. Example:
iex> Cldr.Number.to_string(100, format: :currency, currency: :USD, wrapper: fn
...>   string, :currency_symbol -> "<span class=\"symbol\">" <> string <> "</span>"
...>   string, :number -> "<span class=\"number\">" <> string <> "</span>"
...>   string, :currency_space -> "<span>" <> string <> "</span>"
...>   string, _other -> string
...> end)
{:ok, "<span class=\"symbol\">$</span><span class=\"number\">100.00</span>"}
It is also possible and recommended to use the Phoenix.HTML.Tag.content_tag/3
function if wrapping HTML tags since these will ensure HTML entities are
correctly encoded.  For example:
iex> Cldr.Number.to_string(100, format: :currency, currency: :USD, wrapper: fn
...>   string, :currency_symbol -> Phoenix.HTML.Tag.content_tag(:span, string, class: "symbol")
...>   string, :number -> Phoenix.HTML.Tag.content_tag(:span, string, class: "number")
...>   string, :currency_space -> Phoenix.HTML.Tag.content_tag(:span, string)
...>   string, _other -> string
...> end)
{:ok, "<span class=&quot;symbol&quot;>$</span><span class=&quot;number&quot;>100.00</span>"}

  • Adds the number formats :currency_no_symbol and :accounting_no_symbol that can be used to format currency amounts without an associated currency symbol.

  • Removes the Cldr.Number.to_string/3 requirement for a currency to be provided (or derived) when the format is :currency. If a currency is provided, the format :currency is used. If a currency is not provided, the format :currency_no_symbol is used.

Changelog

Sourced from ex_cldr_numbers's changelog.

Cldr_Numbers v2.29.0

This is the changelog for Cldr v2.29.0 released on January 17th, 2023. For older changelogs please consult the release tag on GitHub

Behavior change

  • In prior releases formatting a number as format: :currency would derive the currency code from the locale if no :currency_code was provided. This is no longer the case. As of CLDR42 a format :currency_no_symbol is defined to allow formatting of the number without an associated symbol. Now when format: :currency is passed without a :currency_code option, the format is changed to format: :currency_no_symbol. To retain the existing behaviour, pass currency_code: Cldr.Currency.currency_from_locale(locale) as an option.

  • In prior releases the currency format (:currency or :accounting) would be overriden by any choice expressed in the locale. That is no longer the case from this release. To retain the existing behaviour, pass format: Cldr.Currency.currency_format_from_locale(locale) as an option.

Enhancements

  • Adds an option :wrapper to Cldr.Number.to_string/2. The argument is a 2-arity function that receives the parameters string and tag where tag is one of :number, :currency_symbol, :currency_space, :literal, :quote, :percent, :permille, :minus or :plus. The function must return a string or a "safe string" such as that returned by Phoenix.HTML.Tag.content_tag/3. The function can be used to wrap format elements in HTML or other tags. Thanks to @​rubas for the motivation and review. Example:
iex> Cldr.Number.to_string(100, format: :currency, currency: :USD, wrapper: fn
...>   string, :currency_symbol -> "<span class=\"symbol\">" <> string <> "</span>"
...>   string, :number -> "<span class=\"number\">" <> string <> "</span>"
...>   string, :currency_space -> "<span>" <> string <> "</span>"
...>   string, _other -> string
...> end)
{:ok, "<span class=\"symbol\">$</span><span class=\"number\">100.00</span>"}
It is also possible and recommended to use the Phoenix.HTML.Tag.content_tag/3
function if wrapping HTML tags since these will ensure HTML entities are
correctly encoded.  For example:
iex> Cldr.Number.to_string(100, format: :currency, currency: :USD, wrapper: fn
...>   string, :currency_symbol -> Phoenix.HTML.Tag.content_tag(:span, string, class: "symbol")
...>   string, :number -> Phoenix.HTML.Tag.content_tag(:span, string, class: "number")
...>   string, :currency_space -> Phoenix.HTML.Tag.content_tag(:span, string)
...>   string, _other -> string
...> end)
{:ok, "<span class=&quot;symbol&quot;>$</span><span class=&quot;number&quot;>100.00</span>"}

  • Adds the number formats :currency_no_symbol and :accounting_no_symbol that can be used to format currency amounts without an associated currency symbol.

  • Removes the Cldr.Number.to_string/3 requirement for a currency to be provided (or derived) when the format is :currency. If a currency is provided, the format :currency is used. If a currency is not provided, the format :currency_no_symbol is used.

Commits
  • 7d388c8 Update changelog with additional examples of wrapping
  • 0665735 :wrapper option can return Phoenix.HTML safe strings which means using those ...
  • 935a170 Improve wrapper docs after @​rubas feedback
  • dc81a40 Fix duplicated doc text
  • e5c7156 Update docs for release 2.29.0
  • 9f6fc54 Support :currency_no_symbol to_string option
  • 36296e7 Add :wrapper option to Cldr.Number.to_string/2
  • See full diff in compare view

Dependabot compatibility score

Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


Dependabot commands and options

You can trigger Dependabot actions by commenting on this PR:

  • @dependabot rebase will rebase this PR
  • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
  • @dependabot merge will merge this PR after your CI passes on it
  • @dependabot squash and merge will squash and merge this PR after your CI passes on it
  • @dependabot cancel merge will cancel a previously requested merge and block automerging
  • @dependabot reopen will reopen this PR if it is closed
  • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
  • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
  • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
  • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)

@dependabot dependabot bot added dependencies Pull requests that update a dependency file elixir Pull requests that update Elixir code labels Jan 18, 2023
@cla-bot cla-bot bot added the cla-signed label Jan 18, 2023
@github-actions github-actions bot enabled auto-merge (squash) January 18, 2023 07:06
@coveralls
Copy link

coveralls commented Jan 18, 2023

Coverage Status

Coverage: 53.127%. Remained the same when pulling cfe3aff on dependabot/hex/ex_cldr_numbers-2.29.0 into 154044d on main.

@dependabot dependabot bot force-pushed the dependabot/hex/ex_cldr_numbers-2.29.0 branch from 747b173 to 4d404f1 Compare January 18, 2023 19:46
Bumps [ex_cldr_numbers](https://github.com/elixir-cldr/cldr_numbers) from 2.28.0 to 2.29.0.
- [Release notes](https://github.com/elixir-cldr/cldr_numbers/releases)
- [Changelog](https://github.com/elixir-cldr/cldr_numbers/blob/master/CHANGELOG.md)
- [Commits](elixir-cldr/cldr_numbers@v2.28.0...v2.29.0)

---
updated-dependencies:
- dependency-name: ex_cldr_numbers
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
@dependabot dependabot bot force-pushed the dependabot/hex/ex_cldr_numbers-2.29.0 branch from 4d404f1 to cfe3aff Compare January 21, 2023 15:48
@github-actions github-actions bot merged commit 4db093d into main Jan 21, 2023
@github-actions github-actions bot deleted the dependabot/hex/ex_cldr_numbers-2.29.0 branch January 21, 2023 16:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cla-signed dependencies Pull requests that update a dependency file elixir Pull requests that update Elixir code
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant