Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
kipcole9 committed Apr 5, 2022
2 parents a38d787 + deddb55 commit 3fd8a2e
Show file tree
Hide file tree
Showing 8 changed files with 26 additions and 26 deletions.
10 changes: 5 additions & 5 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -207,15 +207,15 @@ This is the changelog for Cldr_units v3.5.1 released on April 11th, 2021. For o

### Bug Fixes

* Use `:other` plural category to format units which have a value of 0, 1 or 2 when the natural unit pattern has no substitutions. This corrects the situation in locales such as `he` and `ar` where the unit pattern for plural category `:one` has no substitutions. Previously this would means the formatted string for a unit with a vaue of `1` and `-1` would both output the same string. Thanks to @jarrodmoldrich for the report and to @voltone for his family's help with hebrew grammar.
* Use `:other` plural category to format units which have a value of 0, 1 or 2 when the natural unit pattern has no substitutions. This corrects the situation in locales such as `he` and `ar` where the unit pattern for plural category `:one` has no substitutions. Previously this would means the formatted string for a unit with a value of `1` and `-1` would both output the same string. Thanks to @jarrodmoldrich for the report and to @voltone for his family's help with hebrew grammar.

## Cldr_Units v3.5.0

This is the changelog for Cldr_units v3.5.0 released on April 8th, 2021. For older changelogs please consult the release tag on [GitHub](https://github.com/elixir-cldr/cldr_units/tags)

### Overview

In this release the `Cldr.Unit.to_string/{1, 2, 3}` function has been rewritten and the concrete impementation is now in `Cldr.Unit.Format`. The primary reasons for rewriting are:
In this release the `Cldr.Unit.to_string/{1, 2, 3}` function has been rewritten and the concrete implementation is now in `Cldr.Unit.Format`. The primary reasons for rewriting are:

1. Improves performance by 20% over the old implementation.
2. Supports grammatical case and grammatical gender. These allow for better sentence formation in a localised fashion. Only are few locales have the required data for now (for example, `fr` and `de`) however more locales will have data in upcoming CLDR releases.
Expand Down Expand Up @@ -286,7 +286,7 @@ This is the changelog for Cldr_units v3.5.0-rc.1 released on March 21st, 2021.

### Overview

In this release the `Cldr.Unit.to_string/{1, 2, 3}` function has been rewritten and the concrete impementation is now in `Cldr.Unit.Format`. The primary reasons for rewriting are:
In this release the `Cldr.Unit.to_string/{1, 2, 3}` function has been rewritten and the concrete implementation is now in `Cldr.Unit.Format`. The primary reasons for rewriting are:

1. Improves performance by 20% over the old implementation.
2. Supports grammatical case and grammatical gender. These allow for better sentence formation in a localised fashion. Only are few locales have the required data for now (for example, `fr` and `de`) however more locales will have data in upcoming CLDR releases.
Expand Down Expand Up @@ -595,7 +595,7 @@ This is the changelog for Cldr_units v2.6.0 released on August 25th, 2019. For
[#Unit<:inch, 71>]
```

* Adds a `:per` option to `Cldr.Unit.to_string/3`. This option leverages the `per` formatting style to allow compound units to be printed. For example, assume want to emit a string which represents "kilograms per second". There is no such unit defined in CLDR (or perhaps anywhere!). But if we define the unit `unit = Cldr.Unit.new(:kilogram, 20)` we can then execute `Cldr.Unit.to_string(unit, per: :second)`. Each locale defines a specific way to format such a compount unit. Usually it will return something like `20 kilograms/second`
* Adds a `:per` option to `Cldr.Unit.to_string/3`. This option leverages the `per` formatting style to allow compound units to be printed. For example, assume want to emit a string which represents "kilograms per second". There is no such unit defined in CLDR (or perhaps anywhere!). But if we define the unit `unit = Cldr.Unit.new(:kilogram, 20)` we can then execute `Cldr.Unit.to_string(unit, per: :second)`. Each locale defines a specific way to format such a compound unit. Usually it will return something like `20 kilograms/second`

* Adds `Cldr.Unit.unit_preferences/0` to map units into a territory preference alternative unit

Expand Down Expand Up @@ -657,7 +657,7 @@ This is the changelog for Cldr_units v2.3.2 released on March 23rd, 2019. For o

### Bug Fixes

* Include `priv` directory in the hex package (thats where the conversion json exists)
* Include `priv` directory in the hex package (that's where the conversion json exists)

## Cldr_Units v2.3.2

Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ iex> Cldr.Unit.to_string 1234, MyApp.Cldr, unit: "foot_per_second"
```
### Unit decomposition

Sometimes its a requirement to decompose a unit into one or more subunits. For example, if someone is 6.3 feet heigh we would normally say "6 feet, 4 inches". This can be achieved with `Cldr.Unit.decompose/2`. Using our example:
Sometimes its a requirement to decompose a unit into one or more subunits. For example, if someone is 6.3 feet height we would normally say "6 feet, 4 inches". This can be achieved with `Cldr.Unit.decompose/2`. Using our example:

```elixir
iex> height = Cldr.Unit.new(:foot, 6.3)
Expand Down Expand Up @@ -440,7 +440,7 @@ One invocation of `Cldr.Unit.Additional.unit_localization/4` should made for eac

* `unit` is the name of the additional unit as an `atom`.

* `locale` is the locale name for this localization. It should be one of the locale configured in this backend although this cannot currently be confirmed at compile tiem.
* `locale` is the locale name for this localization. It should be one of the locale configured in this backend although this cannot currently be confirmed at compile time.

* `style` is one of `:long`, `:short`, or `:narrow`.

Expand All @@ -460,7 +460,7 @@ six keys:

Only the `:other` key is required. For english, providing keys for `:one` and `:other` is enough. Other languages have different grammatical requirements.

The key `:display_name` is used by the function `Cldr.Unit.display_name/1` which is primarly used to support UI applications.
The key `:display_name` is used by the function `Cldr.Unit.display_name/1` which is primarily used to support UI applications.

### Sorting Units

Expand Down
18 changes: 9 additions & 9 deletions lib/cldr/unit.ex
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@ defmodule Cldr.Unit do
units of compatible type (like length or volume)
* `Cldr.Unit.compare/2` to compare one unit to another unit as long as they
are convertable.
are convertible.
* `Cldr.Unit.convert/2` to convert one unit to another unit as long as they
are convertable.
are convertible.
* `Cldr.Unit.localize/3` will convert a unit into the units preferred for a
given locale and usage
Expand Down Expand Up @@ -526,7 +526,7 @@ defmodule Cldr.Unit do
The parsed unit must match one of the categories or units in order to
be valid. This is helpful when disambiguating parsed units. For example,
parsing "2w" could be either "2 watts" or "2 weeks". Specifying `only: :duration`
would return "2 weeks". Specifiying `only: :power` would return
would return "2 weeks". Specifying `only: :power` would return
"2 watts"
* `:except` is the oppostte of `:only`. The parsed unit must *not*
Expand Down Expand Up @@ -629,7 +629,7 @@ defmodule Cldr.Unit do
# If there is an :only and/or :except option then
# filter for a match. If there is no match its an
# error. And error could be because the result is
# ambigous (multiple results) or because no category
# ambiguous (multiple results) or because no category
# could be derived for a unit

defp unit_matching_filter(unit, units, only, except) do
Expand Down Expand Up @@ -699,7 +699,7 @@ defmodule Cldr.Unit do
The parsed unit must match one of the categories or units in order to
be valid. This is helpful when disambiguating parsed units. For example,
parsing "2w" could be either "2 watts" or "2 weeks". Specifying `only: :duration`
would return "2 weeks". Specifiying `only: :power` would return
would return "2 weeks". Specifying `only: :power` would return
"2 watts"
* `:except` is the oppostte of `:only`. The parsed unit must *not*
Expand Down Expand Up @@ -852,7 +852,7 @@ defmodule Cldr.Unit do
Formats a number into a string according to a unit definition
for the current process's locale and backend.
The curent process's locale is set with
The current process's locale is set with
`Cldr.put_locale/1`.
See `Cldr.Unit.to_string/3` for full details.
Expand Down Expand Up @@ -982,7 +982,7 @@ defmodule Cldr.Unit do
for the current process's locale and backend or raises
on error.
The curent process's locale is set with
The current process's locale is set with
`Cldr.put_locale/1`.
See `Cldr.Unit.to_string!/3` for full details.
Expand Down Expand Up @@ -1285,10 +1285,10 @@ defmodule Cldr.Unit do
Localizes a unit according to the current
processes locale and backend.
The curent process's locale is set with
The current process's locale is set with
`Cldr.put_locale/1`.
See `Cldr.Unit.localize/3` for futher
See `Cldr.Unit.localize/3` for further
details.
"""
Expand Down
4 changes: 2 additions & 2 deletions lib/cldr/unit/additional.ex
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ defmodule Cldr.Unit.Additional do
* `locale` is the locale name for this
localization. It should be one of the locale
configured in this backend although this
cannot currently be confirmed at compile tiem.
cannot currently be confirmed at compile time.
* `style` is one of `:long`, `:short`, or
`:narrow`.
Expand Down Expand Up @@ -186,7 +186,7 @@ defmodule Cldr.Unit.Additional do
languages have different grammatical requirements.
The key `:display_name` is used by the function
`Cldr.Unit.display_name/1` which is primarly used
`Cldr.Unit.display_name/1` which is primarily used
to support UI applications.
"""
Expand Down
2 changes: 1 addition & 1 deletion lib/cldr/unit/base_unit.ex
Original file line number Diff line number Diff line change
Expand Up @@ -364,7 +364,7 @@ defmodule Cldr.Unit.BaseUnit do
def canonical_base_unit!(unit_string) when is_binary(unit_string) do
case canonical_base_unit(unit_string) do
{:ok, unit_name} -> unit_name
{:eror, {exception, reason}} -> raise exception, reason
{:error, {exception, reason}} -> raise exception, reason
end
end

Expand Down
2 changes: 1 addition & 1 deletion lib/cldr/unit/conversion.ex
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ defmodule Cldr.Unit.Conversion do
{:ok, conversion_2, :forward}
end

# Its invertable so see if thats convertible. Note that
# Its invertable so see if that's convertible. Note that
# there is no difference in the conversion for an inverted
# conversion. Its only a hint so that in convert_from_base/2
# we know to divide, not multiple the value.
Expand Down
8 changes: 4 additions & 4 deletions lib/cldr/unit/format.ex
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ defmodule Cldr.Unit.Format do
Formats a number into a string according to a unit definition
for the current process's locale and backend.
The curent process's locale is set with
The current process's locale is set with
`Cldr.put_locale/1`.
See `Cldr.Unit.to_string/3` for full details.
Expand Down Expand Up @@ -219,7 +219,7 @@ defmodule Cldr.Unit.Format do
for the current process's locale and backend or raises
on error.
The curent process's locale is set with
The current process's locale is set with
`Cldr.put_locale/1`.
See `Cldr.Unit.to_string!/3` for full details.
Expand Down Expand Up @@ -331,7 +331,7 @@ defmodule Cldr.Unit.Format do
Formats a number into an iolist according to a unit definition
for the current process's locale and backend.
The curent process's locale is set with
The current process's locale is set with
`Cldr.put_locale/1`.
See `Cldr.Unit.Format.to_iolist/3` for full details.
Expand Down Expand Up @@ -472,7 +472,7 @@ defmodule Cldr.Unit.Format do
Formats a number into an iolist according to a unit definition
for the current process's locale and backend.
The curent process's locale is set with
The current process's locale is set with
`Cldr.put_locale/1`.
See `Cldr.Unit.Format.to_iolist!/3` for full details.
Expand Down
2 changes: 1 addition & 1 deletion lib/cldr/unit/parser.ex
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,7 @@ defmodule Cldr.Unit.Parser do
def canonical_unit_name!(unit_string) when is_binary(unit_string) do
case canonical_unit_name(unit_string) do
{:ok, unit_name} -> unit_name
{:eror, {exception, reason}} -> raise exception, reason
{:error, {exception, reason}} -> raise exception, reason
end
end

Expand Down

0 comments on commit 3fd8a2e

Please sign in to comment.