Cldr.Unit.measurement_system_for_territory

You're seeing just the function measurement_system_for_territory, go back to Cldr.Unit module for more information.
Link to this function

measurement_system_for_territory(territory, category \\ :default)

View Source

Specs

measurement_system_for_territory(atom(), atom()) ::
  :metric
  | :ussystem
  | :uksystem
  | :a4
  | :us_letter
  | {:error, {module(), String.t()}}

Returns the default measurement system for a territory and a given system key.

Arguments

  • territory is any valid territory returned by Cldr.validate_territory/1

  • key is any measurement system key. The known keys are :default, :temperature and :paper_size. The default key is :default.

Examples

iex> Cldr.Unit.measurement_system_for_territory :US
:ussystem

iex> Cldr.Unit.measurement_system_for_territory :GB
:uksystem

iex> Cldr.Unit.measurement_system_for_territory :AU
:metric

iex> Cldr.Unit.measurement_system_for_territory :US, :temperature
:ussystem

iex> Cldr.Unit.measurement_system_for_territory :GB, :temperature
:uksystem

iex> Cldr.Unit.measurement_system_for_territory :GB, :volume
{:error,
 {Cldr.Unit.InvalidSystemKeyError,
  "The key :volume is not known. Valid keys are :default, :paper_size and :temperature"}}