Skip to content

Commit

Permalink
Don't transliterate digits if the from and to number systems are the …
Browse files Browse the repository at this point in the history
…same
  • Loading branch information
kipcole9 committed Jun 12, 2019
1 parent 49a16be commit 7fdeb78
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 1 deletion.
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
# Changelog for Cldr_Numbers v2.6.2

This is the changelog for Cldr v2.6.1 released on June 12th, 2019. For older changelogs please consult the release tag on [GitHub](https://github.com/kipcole9/cldr_numbers/tags)

### Bug Fixes

* Don't transliterate in `Cldr.Number.transliterate_digits/3` if `from` and `to` number systems are the same.

# Changelog for Cldr_Numbers v2.6.1

This is the changelog for Cldr v2.6.1 released on June 2nd, 2019. For older changelogs please consult the release tag on [GitHub](https://github.com/kipcole9/cldr_numbers/tags)
Expand Down
4 changes: 4 additions & 0 deletions lib/number/transliterate.ex
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,10 @@ defmodule Cldr.Number.Transliterate do
Module.concat(backend, Number.Transliterate).transliterate(sequence, locale, number_system)
end

def transliterate_digits(digits, from_system, from_system) do
digits
end

def transliterate_digits(digits, from_system, to_system) when is_binary(digits) do
with {:ok, from} <- System.number_system_digits(from_system),
{:ok, to} <- System.number_system_digits(to_system) do
Expand Down
2 changes: 1 addition & 1 deletion mix.exs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ defmodule CldrNumbers.Mixfile do

use Mix.Project

@version "2.6.1"
@version "2.6.2"

def project do
[
Expand Down
10 changes: 10 additions & 0 deletions mix/test_backend.ex
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,13 @@ defmodule MyApp.Cldr do
precompile_transliterations: [{:latn, :arab}, {:arab, :thai}, {:arab, :latn}],
providers: [Cldr.Number]
end

defmodule MyApp.Cldr2 do
@moduledoc false

use Cldr,
default_locale: "en-GB",
locales: ["en-GB", "hu"],
precompile_transliterations: [{:latn, :arab}, {:arab, :thai}, {:arab, :latn}],
providers: [Cldr.Number]
end

0 comments on commit 7fdeb78

Please sign in to comment.