# resolveLanguage

Picks the language to show. A `choice` the host offers wins. Otherwise the
first of `browserLanguages`, in the browser's own order, that the host
offers: an exact tag match, or failing that an offered tag with the same
language subtag (so a browser's `"af-ZA"` gets an offered `"af"`, and
`"en-ZA"` gets an offered `"en-GB"`). Failing all of those, `fallback`.

This is a function exported by `@mapcairn/core`, checked against version 0.2.0.

## Signature

```ts
import { resolveLanguage } from "@mapcairn/core";
 
function resolveLanguage(choice: string | null, offered: readonly string[], browserLanguages: readonly string[], fallback: string): string;
```

## Parameters

- `choice` (`string | null`): The person's stored choice, or `null` to follow the browser.
- `offered` (`readonly string[]`): The tags the host offers.
- `browserLanguages` (`readonly string[]`): The browser's languages, most preferred first.
- `fallback` (`string`): The host's default language, returned when nothing matches.

## Returns

`string`: A tag from `offered`, or `fallback`.

Source: [packages/core/src/messages/resolveLanguage.ts:39](https://github.com/MapCairn/mapcairn/blob/main/packages/core/src/messages/resolveLanguage.ts#L39)
