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

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

Function: getLoadoutSlotName()

getLoadoutSlotName(slot, locale): string | null

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

Resolve a loadout slot's display name for a locale.

Parameters

slot

BuildSlot

A slot returned by enumerateSlots or ShipLoadout.slots.

locale

string

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

Returns

string | null

The slot's English display name for an English locale, otherwise null.

Throws

If slot is not an object or locale is not a string.

Example

import { getLoadoutSlotName } from '@elite-dangerous-almanac/core/i18n/slots';
import { enumerateSlots } from '@elite-dangerous-almanac/core/ships/slots';
import { getShipSlots } from '@elite-dangerous-almanac/core/ships/ships';

const powerPlant = enumerateSlots(getShipSlots('SideWinder')!).find(
  (slot) => slot.kind === 'core' && slot.core === 'powerPlant',
)!;
getLoadoutSlotName(powerPlant, 'en'); // -> 'Power Plant'
⚠️ **GitHub.com Fallback** ⚠️