# generaltranslation: General Translation Core SDK: requiresTranslation URL: https://generaltranslation.com/en-GB/docs/core/class/methods/locales/requires-translation.mdx --- title: requiresTranslation description: API reference for the GT requiresTranslation method --- ## Overview The `requiresTranslation` method determines whether translation is needed based on the source and target locales. It checks whether the source content needs to be translated by comparing locale codes and considering the approved locale list. *** ## Reference ### Parameters ### Parameter descriptions | Parameter | Description | | ----------------- | ------------------------------------------------------------------------------------------ | | `sourceLocale` | The source locale code. If not provided, uses the instance's `sourceLocale` | | `targetLocale` | The target locale code. If not provided, uses the instance's `targetLocale` | | `approvedLocales` | Array of approved target locales. If not provided, uses the instance's `locales` array | | `customMapping` | Optional custom mapping for locale resolution | ### Returns `boolean` - `true` if translation is required, `false` otherwise ### Throws * `Error` - If no source locale is provided and the instance has no `sourceLocale` configured * `Error` - If no target locale is provided and the instance has no `targetLocale` configured *** ## Examples ```typescript const gt = new GT({ sourceLocale: 'en-US', targetLocale: 'es-ES', locales: ['en-US', 'es-ES', 'fr-FR', 'de-DE'] }); // Different languages require translation console.log(gt.requiresTranslation('en-US', 'es-ES')); // true console.log(gt.requiresTranslation('en-US', 'fr-FR')); // true // Same languages don't require translation console.log(gt.requiresTranslation('en-US', 'en-US')); // false console.log(gt.requiresTranslation('es-ES', 'es-ES')); // false // Different dialects of same language don't require translation console.log(gt.requiresTranslation('en-US', 'en-GB')); // false console.log(gt.requiresTranslation('es-ES', 'es-MX')); // false // Target not in approved locales console.log(gt.requiresTranslation('en-US', 'it-IT')); // false (it-IT not in approved locales) ``` *** ## Notes * Considers locale language families, not just exact matches * Respects approved locale lists * Returns `false` when the target locale is not in the approved locales (if provided) ## Next steps * Check locale relationships with [`isSameLanguage`](/docs/core/class/methods/locales/is-same-language) * Determine the best locale with [`determineLocale`](/docs/core/class/methods/locales/determine-locale) * Validate locales with [`isValidLocale`](/docs/core/class/methods/locales/is-valid-locale)