Skip to content

Commit

Permalink
Fix compound locales with scripts. Release 1.1
Browse files Browse the repository at this point in the history
  • Loading branch information
kipcole9 committed Jul 3, 2021
1 parent db48d61 commit 4a32fd0
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 6 deletions.
8 changes: 6 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,15 @@

## Cldr Locale Display v1.1.0

This is the changelog for Cldr Locale Display v1.1.0 released on ______, 2021. For older changelogs please consult the release tag on [GitHub](https://github.com/elixir-cldr/cldr_locale_display/tags)
This is the changelog for Cldr Locale Display v1.1.0 released on July 3rd, 2021. For older changelogs please consult the release tag on [GitHub](https://github.com/elixir-cldr/cldr_locale_display/tags)

### Bug Fixes

* Correct an issue when the compound name includes the script (like zh-Hant).

### Enhancements

* A `display_names/2` to backend modules.
* Add `display_names/{1,2}` to backend modules.

## Cldr Locale Display v1.0.0

Expand Down
2 changes: 1 addition & 1 deletion lib/cldr/backend.ex
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ defmodule Cldr.LocaleDisplay.Backend do
"""
@doc since: "1.1.0"

@spec display_name(
@spec display_name!(
Cldr.Locale.locale_name() | Cldr.LanguageTag.t(),
Cldr.LocaleDisplay.display_options()
) ::
Expand Down
4 changes: 2 additions & 2 deletions lib/cldr/locale_display.ex
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ defmodule Cldr.LocaleDisplay do
"anglais américain (calendrier grégorien, devise : A$)"
"""
@spec display_name(Cldr.Locale.locale_name() | Cldr.LanguageTag.t(), display_options()) ::
@spec display_name!(Cldr.Locale.locale_name() | Cldr.LanguageTag.t(), display_options()) ::
String.t() | no_return()

def display_name!(language_tag, options \\ []) do
Expand Down Expand Up @@ -242,7 +242,7 @@ defmodule Cldr.LocaleDisplay do
# If we don't want a compound language then we need to omit
# the territory when matching but restore is afterwards so
# its generated as a subtag
@reinstate_subtags [:script, :territory]
@reinstate_subtags [:territory]

defp first_match(
language_tag,
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.LocaleDisplay.MixProject do
use Mix.Project

@version "1.1.0-dev"
@version "1.1.0"

def project do
[
Expand Down
4 changes: 4 additions & 0 deletions test/locale_display_name_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -28,5 +28,9 @@ defmodule Cldr.LocaleDisplayName.Test do
import Cldr.LanguageTag.Sigil

assert Cldr.display_name(~l(en)u) == "English"
assert Cldr.display_name(~l(zh-Hans)u) == "Simplified Chinese"
assert Cldr.display_name(~l(zh-Hant)u) == "Traditional Chinese"
assert Cldr.display_name(~l(zh-Hant)) == "Traditional Chinese (Taiwan)"
assert Cldr.display_name(~l(zh-Hans)) == "Simplified Chinese (China)"
end
end

0 comments on commit 4a32fd0

Please sign in to comment.