diff --git a/CHANGELOG.md b/CHANGELOG.md index 608df61..e6f60ca 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -207,7 +207,7 @@ 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 @@ -215,7 +215,7 @@ This is the changelog for Cldr_units v3.5.0 released on April 8th, 2021. For ol ### 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. @@ -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. @@ -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 @@ -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 diff --git a/README.md b/README.md index 552296b..764dcd5 100644 --- a/README.md +++ b/README.md @@ -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) @@ -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`. @@ -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 diff --git a/lib/cldr/unit.ex b/lib/cldr/unit.ex index cf3920e..c23c374 100644 --- a/lib/cldr/unit.ex +++ b/lib/cldr/unit.ex @@ -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 @@ -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* @@ -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 @@ -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* @@ -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. @@ -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. @@ -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. """ diff --git a/lib/cldr/unit/additional.ex b/lib/cldr/unit/additional.ex index 45f38ad..8a260af 100644 --- a/lib/cldr/unit/additional.ex +++ b/lib/cldr/unit/additional.ex @@ -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`. @@ -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. """ diff --git a/lib/cldr/unit/base_unit.ex b/lib/cldr/unit/base_unit.ex index 4f6eade..4994a39 100644 --- a/lib/cldr/unit/base_unit.ex +++ b/lib/cldr/unit/base_unit.ex @@ -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 diff --git a/lib/cldr/unit/conversion.ex b/lib/cldr/unit/conversion.ex index c9fc995..b9067db 100644 --- a/lib/cldr/unit/conversion.ex +++ b/lib/cldr/unit/conversion.ex @@ -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. diff --git a/lib/cldr/unit/format.ex b/lib/cldr/unit/format.ex index 67d88bf..4788db0 100644 --- a/lib/cldr/unit/format.ex +++ b/lib/cldr/unit/format.ex @@ -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. @@ -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. @@ -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. @@ -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. diff --git a/lib/cldr/unit/parser.ex b/lib/cldr/unit/parser.ex index ac338be..3b41fff 100644 --- a/lib/cldr/unit/parser.ex +++ b/lib/cldr/unit/parser.ex @@ -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