Skip to content

Latest commit

 

History

History
32 lines (20 loc) · 850 Bytes

File metadata and controls

32 lines (20 loc) · 850 Bytes

@intlify/h3


@intlify/h3 / tryCookieLocale

Function: tryCookieLocale()

function tryCookieLocale(event, __namedParameters?): Locale | null;

try to get locale from cookie

Parameters

Parameter Type Description
event H3Event The H3Event | H3 event
__namedParameters? { lang?: string; name?: string; } -
__namedParameters.lang? string -
__namedParameters.name? string -

Returns

Locale | null

The locale that resolved from cookie. if lang option or cookie name value are not a well-formed BCP 47 language tag, return null.

Description

Unlike getCookieLocale, this function does not throw an error if the locale cannot be obtained, this function returns null.