Skip to main content

Function: selectStarterPacksForLanguage()

selectStarterPacksForLanguage(packs, locale): StarterPack[]

Defined in: Data/Core/StarterPackTypes.ts:343

Pick the packs offered for a UI locale, best match first.

Matching is two-tier so that a user on es-MX still sees a pack tagged plain es, and a user on zh-Hans is not offered a zh-Hant pack:

  1. Exact tag match (case-insensitive) — es-MXes-MX.
  2. Primary-subtag match where neither side declares a conflicting script — es-MXes. A tag carrying a script subtag (zh-Hans) only falls back to another tag with the same script, because Simplified and Traditional Chinese are not interchangeable content.

Returns [] when nothing matches, which is a normal outcome the first-run UI must handle — see the hi note on SUPPORTED_CONTENT_LANGUAGES.

Parameters

packs

readonly StarterPack[]

locale

string

Returns

StarterPack[]