# generaltranslation: General Translation Core SDK: determineLocale URL: https://generaltranslation.com/ja/docs/core/functions/locales/determine-locale.mdx --- title: determineLocale description: determineLocale 関数のAPIリファレンス --- ## 概要 `determineLocale` 関数は、GT クラスのインスタンスがなくても、ユーザー設定に基づいて承認済みのロケールから最も適したロケールを判定します。 *** ## リファレンス ### パラメーター ### 戻り値 `string | undefined` - 最も適したロケール。一致するものがない場合は undefined *** ## 例 ### コンテンツネゴシエーション ```typescript import { determineLocale } from 'generaltranslation'; const approvedLocales = ['en-US', 'es-ES', 'fr-FR', 'de-DE']; // 完全一致 console.log(determineLocale('en-US', approvedLocales)); // 'en-US' // 言語フォールバック console.log(determineLocale('en-GB', approvedLocales)); // 'en-US' // 複数の優先設定 console.log(determineLocale(['fr-CA', 'es-MX'], approvedLocales)); // 'es-ES' // 一致なし console.log(determineLocale('it-IT', approvedLocales)); // undefined ``` *** ## 注意事項 * インテリジェントなロケールネゴシエーションを実装します * 承認済みリストから、最初に見つかった完全一致または言語一致を返します * 入力配列の優先順を尊重します * 一致が見つからない場合は undefined を返します * Web アプリケーションのロケールネゴシエーションに不可欠です ## 次のステップ * GT クラスのメソッド [`determineLocale`](/docs/core/class/methods/locales/determine-locale) を使用する * [`requiresTranslation`](/docs/core/functions/locales/requires-translation) で翻訳の要否を確認する