getLocalizedString Method

Return the translated value of a key.

getLocalizedString(key: string | string[]): string

@note The key includes the namespace, which identifies the particular localization file that contains the property, followed by a colon, followed by the property in the JSON file. For example:

const dataString: string = IModelApp.localization.getLocalizedString("iModelJs:BackgroundMap.BingDataAttribution");

assigns to dataString the string with property BackgroundMap.BingDataAttribution from the iModelJs.json localization file.

@returns The string corresponding to the first key that resolves.

@throws Error if no keys resolve to a string.

Parameter Type Description
key string | string[] the key that matches a property in the JSON localization file.

Returns - string

The string corresponding to the first key that resolves.

Defined in

Last Updated: 14 November, 2024