@inlang/paraglide-js
Version:
[](https://www.npmjs.com/package/@inlang/paraglide-js) [ in their getLocale method.
*
* The function first processes any custom server strategies asynchronously, then falls back
* to the synchronous `extractLocaleFromRequest` for all other strategies.
*
* @see {@link https://github.com/opral/inlang-paraglide-js/issues/527#issuecomment-2978151022}
*
* @example
* // Basic usage
* const locale = await extractLocaleFromRequestAsync(request);
*
* @example
* // With custom async server strategy
* defineCustomServerStrategy("custom-database", {
* getLocale: async (request) => {
* const userId = extractUserIdFromRequest(request);
* return await getUserLocaleFromDatabase(userId);
* }
* });
*
* const locale = await extractLocaleFromRequestAsync(request);
*
* @param {Request} request - The request object to extract the locale from.
* @param {{ effectiveRequestUrl?: string | URL }} [options] - Effective request URL to use for route matching and locale detection with the URL strategy.
* @returns {Promise<Locale>} The extracted locale.
*/
export declare const extractLocaleFromRequestAsync: (request: Request, options?: {
effectiveRequestUrl?: string | URL;
}) => Promise<Locale>;
//# sourceMappingURL=extract-locale-from-request-async.d.ts.map