Home > @magiclane/maps-sdk > PTAlertInfo > selectTranslation

PTAlertInfo.selectTranslation() method

Select the best translation for a language.

Exact match on language, else the first entry; undefined when the list is empty.

Signature:

static selectTranslation(translations: PTAlertTranslation[], language: string): PTAlertTranslation | undefined;

Parameters

Parameter

Type

Description

translations

PTAlertTranslation[]

Translation list to select from

language

string

Language to match

Returns:

PTAlertTranslation | undefined

The matching translation, the first entry as fallback, or undefined