> For the complete documentation index, see [llms.txt](https://docs.digitalhumans.jp/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.digitalhumans.jp/dev/hosted-experience/hosted-experience-display-strings.md).

# 表示文字列（多言語対応）

ホステッドエクスペリエンスでユーザーに表示されるテキストを更新することができます。これは、ユーザーのブラウザ設定に基づいて特定の言語のエクスペリエンスを提供したり、ブランドやユーザーエクスペリエンスに合わせてテキストをカスタマイズしたりするために行うことができます。

これを行うには、`languageStrings`プロパティを定義し、ホステッドエクスペリエンスインターフェース内で表示されるテキストを更新します。`languageStrings`オブジェクトには、[ISO-639-1](https://ja.wikipedia.org/wiki/ISO_639-1%E3%82%B3%E3%83%BC%E3%83%89%E4%B8%80%E8%A6%A7)言語（例：`en`、`es`、`ja`など）に対応する値が含まれている必要があります。各言語コード値には、更新したい値のキーを含むオブジェクトを提供します。また、特定のロケール/地域（例：`en-US`、`en-GB`、`de-DE`、`pt-BR`）を指定することで、より精密な言語ターゲット設定が可能です。

ユーザーがデジタルヒューマンエクスペリエンスを読み込むと、ブラウザはユーザーの優先言語リスト（優先順の配列）を提供します。ホステッドエクスペリエンスは、ユーザーのブラウザに設定された優先言語に基づいて、提供された`languageStrings`リストを順に検索し、キーに一致するものを見つけます。ブラウザが優先言語を検出する方法についての詳細は[こちら](https://developer.mozilla.org/ja/docs/Web/API/Navigator/languages)で確認できます。

言語コードが提供されていない場合は、`default`値が使用されます。`default`設定が指定されていない場合は、ホステッドエクスペリエンスの基本値が使用されます。

以下のコードブロックは、ホステッドエクスペリエンス内でUIテキストを置き換えるために使用できる`languageString`キーの完全なリストと、その基本値を表示しています。

```jsx
const uneeqOptions = {
    languageStrings: {
        "default": {
            callToActionText: '👋 Hey! It is so good to meet you.',
            errorText: 'An error occurred.',
            textInputPlaceholder: 'Type here...',
            showContentToolTip: 'Show Content',
            sendQuestionButtonToolTip: 'Send Message',
            startRecordingButtonToolTip: 'Start Recording',
            unmuteMicrophoneToolTip: 'Unmute',
            muteMicrophoneToolTip: 'Mute',
            microphonePermissionNotAllowedButtonToolTip: 'Microphone permission not allowed',
            microphoneEnabledHintTitle: 'Microphone Enabled',
            microphoneEnabledHintText: 'You can speak to me, I\'m listening.',
            microphoneEnabledHintTitleOverlay: 'Mic Enabled',
            microphoneNotAllowedMessage: 'Microphone permission was not allowed. Please allow access to your microphone ' +
            'via your browser settings, and try again.',
            recordingTapToStart: 'Tap to record, tap again to send',
            recordingSpeakNowPrompt: 'Speak now',
            recordingTapStopWhenDone: 'Tap stop when done',
            recordingStopButtonToolTip: 'Stop Recording',
            recordingRequestingMicrophonePrompt: 'Requesting Microphone',
            settingsExitButton: 'Exit',
            confirmExitDescription: 'Are you sure you want to exit?',
            confirmExitStayButton: 'STAY',
            confirmExitEndButton: 'EXIT',
            hideContentButton: 'Hide Content',
            hideDigitalHumanButton: 'Hide Digital Human',
            sessionEndedDueToInactivity: 'Digital human conversation has ended due to inactivity.',
            sessionEndedByUser: 'Digital human conversation ended.',
            sessionEndedDueToConnectionLoss: 'Digital human conversation has ended due to a connection issue.',
            sessionEndedUnexpectedly: 'Digital human conversation has ended unexpectedly.',
            sessionTransferred: 'Digital human conversation has transitioned.',
            reconnectingText: 'reconnecting...',
            muteDigitalHumanToolTip: 'Mute digital human audio',
            unmuteDigitalHumanToolTip: 'Unmute digital human audio',
            sessionEndedDueToVideoPlaybackError: 'Digital human conversation has ended due to a video playback error.',
            sessionEndedDueToPermissionsError: 'Digital human conversation has ended due to a permissions error. Please check your browser settings.',
            sessionEndedDueToRendererError: 'Digital human conversation has ended due to a configuration error. Please contact a support person.',
            errorDigitalHumanResponse: 'Sorry, something has gone wrong. Please try again soon. (16001)',
            videoAutoplayBlockedText: 'Click to resume the digital human.',
            networkUnstableText: 'Poor network connection — the video may pause. Try moving closer to your Wi-Fi router or improving your network speed.',
            networkReconnectingText: 'Reconnecting — your connection dropped.',
            tryAgainError: 'Something went wrong, please try again.'
        }
    }
}
```

```jsx
const uneeqOptions = {
    languageStrings: {
        "default": {
            callToActionText: '👋 こんにちは！デジタルヒューマンのソフィーです',
						errorText: 'エラーが発生しました。',
						textInputPlaceholder: 'こちらにメッセージを入力...',
						showContentToolTip: 'コンテンツを表示',
						sendQuestionButtonToolTip: 'メッセージを送信',
						startRecordingButtonToolTip: '録音開始',
						unmuteMicrophoneToolTip: 'ミュート解除',
						muteMicrophoneToolTip: 'ミュート',
						microphonePermissionNotAllowedButtonToolTip: 'マイクの使用が許可されていません',
						microphoneEnabledHintTitle: 'マイクが有効です',
						microphoneEnabledHintText: 'お話しください。お聞きしております。',
						microphoneEnabledHintTitleOverlay: 'マイク ON',
						microphoneNotAllowedMessage: 'マイクの使用が許可されていません。ブラウザの設定でマイクへのアクセスを許可してから、もう一度お試しください。',
						recordingTapToStart: 'タップして録音開始、もう一度タップして送信',
						recordingSpeakNowPrompt: 'お話しください',
						recordingTapStopWhenDone: '終了したらタップして停止',
						recordingStopButtonToolTip: '録音停止',
						recordingRequestingMicrophonePrompt: 'マイクにアクセス中',
						settingsExitButton: '終了',
						confirmExitDescription: '本当に終了しますか？',
						confirmExitStayButton: '続ける',
						confirmExitEndButton: '終了する',
						hideContentButton: 'コンテンツを非表示',
						hideDigitalHumanButton: 'デジタルヒューマンを非表示',
						sessionEndedDueToInactivity: 'デジタルヒューマンとの会話が非アクティブのため終了しました。',
						sessionEndedByUser: 'デジタルヒューマンとの会話が終了しました。',
						sessionEndedDueToConnectionLoss: '接続の問題により、デジタルヒューマンとの会話が終了しました。',
						sessionEndedUnexpectedly: '予期せぬ理由により、デジタルヒューマンとの会話が終了しました。',
						sessionTransferred: 'デジタルヒューマンとの会話が引き継がれました。',
						reconnectingText: '再接続しています・・・',
						muteDigitalHumanToolTip: 'デジタルヒューマンの音声をミュート',
						unmuteDigitalHumanToolTip: 'デジタルヒューマンの音声のミュートを解除',
						sessionEndedDueToVideoPlaybackError: '動画再生エラーのため、デジタルヒューマンとの会話が終了しました。',
						sessionEndedDueToPermissionsError: '権限エラーのため、デジタルヒューマンとの会話が終了しました。ブラウザの設定をご確認ください。',
						sessionEndedDueToRendererError: '設定エラーのため、デジタルヒューマンとの会話が終了しました。サポート担当者にお問い合わせください。',
						errorDigitalHumanResponse: '申し訳ございません、問題が発生しました。しばらくしてから再度お試しください。(16001)',
						videoAutoplayBlockedText: 'クリックしてデジタルヒューマンを再開してください。',
						networkUnstableText: 'ネットワークが不安定です。映像が一時停止する場合があります。Wi-Fiルーターに近づくか、通信環境をご確認ください。',
						networkReconnectingText: '再接続しています・・・接続が切断されました。',
						tryAgainError: '問題が発生しました。もう一度お試しください。'
        }
    }
}
```

## 言語置換

独自の文字列を、定義した各ホステッドエクスペリエンス言語に対して提供することができます。

例えば、'es'言語の`callToActionText`を以下のように置き換えることができます：

```jsx
languageStrings: {
    "es": {
        "callToActionText": "¡Hola! Haga clic aquí para iniciar una conversación.e"
    }
}
```

多言語サイトへの対応例:

```jsx
 const uneeqOptions = {
    languageStrings: {
        "es": {
            "callToActionText": "¡Hola! Haga clic aquí para iniciar una conversación.e",
            "textInputPlaceholder": "Escriba aquí..."
        },
        "ja": {
            "callToActionText": "やあ！会話を始めるにはここをクリックしてください。",
            "textInputPlaceholder": "ここに入力..."
        },
        "de-DE": {
            "callToActionText": "Hi! Klicken Sie hier, um ein Gespräch zu beginnen.",
            "textInputPlaceholder": "Geben Sie hier ein ..."
        },
        "default": {
            callToActionText: '👋 Hey! It is so good to meet you.',
            errorText: 'An error occurred.',
            textInputPlaceholder: 'Type here...',
            showContentToolTip: 'Show Content',
            sendQuestionButtonToolTip: 'Send Message',
            startRecordingButtonToolTip: 'Start Recording',
            unmuteMicrophoneToolTip: 'Unmute',
            muteMicrophoneToolTip: 'Mute',
            microphonePermissionNotAllowedButtonToolTip: 'Microphone permission not allowed',
            microphoneEnabledHintTitle: 'Microphone Enabled',
            microphoneEnabledHintText: 'You can speak to me, I\'m listening.',
            microphoneEnabledHintTitleOverlay: 'Mic Enabled',
            microphoneNotAllowedMessage: 'Microphone permission was not allowed. Please allow access to your microphone ' +
            'via your browser settings, and try again.',
            recordingTapToStart: 'Tap to record, tap again to send',
            recordingSpeakNowPrompt: 'Speak now',
            recordingTapStopWhenDone: 'Tap stop when done',
            recordingStopButtonToolTip: 'Stop Recording',
            recordingRequestingMicrophonePrompt: 'Requesting Microphone',
            settingsExitButton: 'Exit',
            confirmExitDescription: 'Are you sure you want to exit?',
            confirmExitStayButton: 'STAY',
            confirmExitEndButton: 'EXIT',
            hideContentButton: 'Hide Content',
            hideDigitalHumanButton: 'Hide Digital Human',
            sessionEndedDueToInactivity: 'Digital human conversation has ended due to inactivity.',
            sessionEndedByUser: 'Digital human conversation ended.',
            sessionEndedDueToConnectionLoss: 'Digital human conversation has ended due to a connection issue.',
            sessionEndedUnexpectedly: 'Digital human conversation has ended unexpectedly.',
            sessionTransferred: 'Digital human conversation has transitioned.',
            reconnectingText: 'reconnecting...',
            muteDigitalHumanToolTip: 'Mute digital human audio',
            unmuteDigitalHumanToolTip: 'Unmute digital human audio',
            sessionEndedDueToVideoPlaybackError: 'Digital human conversation has ended due to a video playback error.',
            sessionEndedDueToPermissionsError: 'Digital human conversation has ended due to a permissions error. Please check your browser settings.',
            sessionEndedDueToRendererError: 'Digital human conversation has ended due to a configuration error. Please contact a support person.',
            errorDigitalHumanResponse: 'Sorry, something has gone wrong. Please try again soon. (16001)',
            videoAutoplayBlockedText: 'Click to resume the digital human.',
            networkUnstableText: 'Poor network connection — the video may pause. Try moving closer to your Wi-Fi router or improving your network speed.',
            networkReconnectingText: 'Reconnecting — your connection dropped.',
            tryAgainError: 'Something went wrong, please try again.'
        }
    }
}
```
