# `Tempo.Territory`
[🔗](https://github.com/elixir-tempo/tempo/blob/v2.1.0/lib/tempo/territory.ex#L1)

Which territory a caller means: the CLDR territory (`:US`, `:SA`, `:GB`)
whose weekend, workdays and conventions Tempo asks Localize for.

A territory may be named directly, taken from a locale, or left to the
application: `nil` is the configured `:default_territory`, and failing
that the territory of the current locale.

    config :ex_tempo, default_territory: :AU

# `resolve`

```elixir
@spec resolve(atom() | String.t() | Localize.LanguageTag.t() | nil) ::
  {:ok, atom()} | {:error, Exception.t()}
```

The territory a value names.

### Arguments

* `value` is a territory as an atom or a string (`:US`, `"sa"`), a locale
  (`"en-GB"`, a `t:Localize.LanguageTag.t/0`) whose territory is taken, or
  `nil` for the application's `:default_territory` and then the current
  locale's.

### Returns

* `{:ok, territory}`, an atom.

* `{:error, %ArgumentError{}}` for a value that names none.

### Examples

    iex> Tempo.Territory.resolve(:US)
    {:ok, :US}

    iex> Tempo.Territory.resolve("sa")
    {:ok, :SA}

    iex> Tempo.Territory.resolve("en-GB")
    {:ok, :GB}

    iex> {:error, %ArgumentError{}} = Tempo.Territory.resolve("nowhere at all")

---

*Consult [api-reference.md](api-reference.md) for complete listing*
