# generaltranslation: General Translation Core SDK: determineLocale URL: https://generaltranslation.com/en-GB/docs/core/functions/locales/determine-locale.mdx --- title: determineLocale description: API reference for the determineLocale function --- ## Overview The `determineLocale` function finds the best matching locale from the approved locales based on user preferences, without requiring a GT class instance. *** ## Reference ### Parameters ### Returns `string | undefined` - Best matching locale or undefined if no match *** ## Examples ### Content negotiation ```typescript import { determineLocale } from 'generaltranslation'; const approvedLocales = ['en-US', 'es-ES', 'fr-FR', 'de-DE']; // Exact match console.log(determineLocale('en-US', approvedLocales)); // 'en-US' // Language fallback console.log(determineLocale('en-GB', approvedLocales)); // 'en-US' // Multiple preferences console.log(determineLocale(['fr-CA', 'es-MX'], approvedLocales)); // 'es-ES' // No match console.log(determineLocale('it-IT', approvedLocales)); // undefined ``` *** ## Notes * Implements intelligent locale negotiation * Returns the first exact or language match from the approved list * Respects preference order in the input array * Returns undefined when no match is found * Essential for web application locale negotiation ## Next steps * Use the GT class method [`determineLocale`](/docs/core/class/methods/locales/determine-locale) * Check whether translation is needed with [`requiresTranslation`](/docs/core/functions/locales/requires-translation)