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

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

これを行うには、`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...'
        }
    }
}
```

```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: '再接続しています・・・'
        }
    }
}
```

## 言語置換

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

例えば、'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.'
        }
    }
}
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.digitalhumans.jp/dev/hosted-experience/hosted-experience-display-strings.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
