# generaltranslation: General Translation Core SDK: determineLocale URL: https://generaltranslation.com/en-US/docs/core/functions/locales/determine-locale.mdx --- title: determineLocale description: API reference for the determineLocale function --- ## Overview The `determineLocale` function determines the best matching locale from 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 first exact or language match from approved list - Respects preference order in input array - Returns undefined when no match found - Essential for web application locale negotiation ## Next steps - Use GT class method [`determineLocale`](/docs/core/class/methods/locales/determine-locale) - Check translation needs with [`requiresTranslation`](/docs/core/functions/locales/requires-translation)