i18n.Function.getSlotRestrictionLabel - Elite-Dangerous-Almanac/Almanac-Core GitHub Wiki

@elite-dangerous-almanac/core / i18n / getSlotRestrictionLabel

Function: getSlotRestrictionLabel()

getSlotRestrictionLabel(restriction, locale): string | null

Defined in: src/i18n/slots.ts:52

Resolve the short display label for a restricted slot.

Parameters

restriction

SlotRestriction

A BuildSlot.restriction value.

locale

string

A BCP 47 locale. The restriction-label sources supply English only.

Returns

string | null

The English label for an English locale, otherwise null.

Throws

If locale is not a string.

Example

import { getSlotRestrictionLabel } from '@elite-dangerous-almanac/core/i18n/slots';

getSlotRestrictionLabel('mining', 'en-GB'); // -> 'mining tools'
getSlotRestrictionLabel('mining', 'fr'); // -> null
⚠️ **GitHub.com Fallback** ⚠️