Skip to content

Commit

Permalink
Fix derive_name_locale/2
Browse files Browse the repository at this point in the history
  • Loading branch information
kipcole9 committed Dec 7, 2024
1 parent fcfd445 commit eb6b0bb
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 6 deletions.
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
# Changelog

## Cldr Person Names v0.2.1

This is the changelog for `ex_cldr_person_names` v0.2.1 released on December 8th, 2024. For older changelogs please consult the release tag on [GitHub](https://github.com/elixir-cldr/cldr_person_names/tags)

### Bug Fixes

* Fixes `Cldr.PersonName.Formatter.derive_name_locale/2`. Thanks to @peaceful-james for the PR. Closes #1.

## Cldr Person Names v0.2.0

This is the changelog for `ex_cldr_person_names` v0.2.0 released on April 24th, 2023. For older changelogs please consult the release tag on [GitHub](https://github.com/elixir-cldr/cldr_person_names/tags)
Expand Down
8 changes: 3 additions & 5 deletions lib/cldr/person_name/formatter.ex
Original file line number Diff line number Diff line change
Expand Up @@ -722,12 +722,10 @@ defmodule Cldr.PersonName.Formatter do

def derive_name_locale(%{locale: nil} = name, formatting_locale) do
name_script = dominant_script(name)
name_locale = find_likely_locale_for_script(name_script, formatting_locale.backend)

if name_locale do
{:ok, name_locale}
else
{:error, "No locale resolved for script #{inspect(name_script)}"}
case find_likely_locale_for_script(name_script, formatting_locale.backend) do
{:ok, name_locale} when not is_nil(name_locale) -> {:ok, name_locale}
_ -> {:error, "No locale resolved for script #{inspect(name_script)}"}
end
end

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.PersonName.Mixfile do
use Mix.Project

@version "0.2.0"
@version "0.2.1"

def project do
[
Expand Down

0 comments on commit eb6b0bb

Please sign in to comment.