Skip to content

Core / locale: consumeChoiceHandoff

Functions, types, and exports for Core / locale: consumeChoiceHandoff.

Page outline

Remove and validate a locale choice handoff from a search string. The caller remains responsible for persisting the accepted choice and updating the URL.

import { consumeChoiceHandoff } from "@palamedes/core/locale"

consumeChoiceHandoff<TLocale extends string>(options: {
    search?: string | null;
    currentLocale: TLocale;
    locales: readonly TLocale[];
    parameterName?: string;
}): {
    choice: TLocale | null;
    search: string;
}

Parameters

NameTypeRequired
options{ search?: string | null; currentLocale: TLocale; locales: readonly TLocale[]; parameterName?: string }Yes

Returns

{ choice: TLocale | null; search: string }

Source entry on GitHub

Last updated: November 1, 2026