# General Translation React SDKs (gt-react, gt-next, gt-react-native): isLocaleSupported URL: https://generaltranslation.com/en-US/docs/react/nextjs/reference/functions/is-locale-supported.mdx --- title: isLocaleSupported description: Check whether a route value resolves to a configured gt-next locale. API reference for isLocaleSupported. --- Use `isLocaleSupported` when an unknown route locale should be rejected instead of falling back to the default locale. Import it from `gt-next`. ## Overview [#overview] ```tsx import { isLocaleSupported } from 'gt-next'; isLocaleSupported('es'); // true or false ``` ## Parameters [#parameters] | Parameter | Description | Type | Optional | Default | | --- | --- | --- | --- | --- | | `locale` | Locale candidate to validate against the current configuration. | `unknown` | No | — | ## Returns [#returns] **Type** `locale is string` Returns `true` when the value resolves to one of the configured locales. The check accepts configured aliases and acts as a TypeScript type guard. Returns `false` for unsupported locales, empty strings, and non-string values. ## Example [#example] Validate the root route parameter before rendering a localized layout: ```tsx title="app/[locale]/layout.tsx" import { isLocaleSupported } from 'gt-next'; import { notFound } from 'next/navigation'; export default async function LocaleLayout({ children, params, }: { children: React.ReactNode; params: Promise<{ locale: string }>; }) { const { locale } = await params; if (!isLocaleSupported(locale)) { notFound(); } return ( {children} ); } ``` `gt-next` otherwise warns and uses `defaultLocale` when a request locale is unsupported. Use this explicit check for strict locale-prefixed routes.