Skip to main content

getAttributeFromLocale

Stentor API Reference


Stentor API Reference / stentor-locales/src / getAttributeFromLocale

Function: getAttributeFromLocale()

getAttributeFromLocale\<T, K>(attribute, defaultObj, locale?, locales?): Partial\<T>[K]

Defined in: packages/stentor-locales/src/getAttributeFromLocale.ts:10

Returns the value of the given attribute from the locales object based on the provided locale.

If it is not found in the locale object, then it will take it from the default object passed in.

Type Parameters​

T​

T extends object

K​

K extends string | number | symbol

Parameters​

attribute​

K

defaultObj​

T

locale?​

Locale

locales?​

Partial\<Record\<Locale, Partial\<T>>> = {}

Returns​

Partial\<T>[K]