表示文字列(多言語対応)

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

これを行うには、languageStringsプロパティを定義し、ホステッドエクスペリエンスインターフェース内で表示されるテキストを更新します。languageStringsオブジェクトには、ISO-639-1言語(例:enesjaなど)に対応する値が含まれている必要があります。各言語コード値には、更新したい値のキーを含むオブジェクトを提供します。また、特定のロケール/地域(例:en-USen-GBde-DEpt-BR)を指定することで、より精密な言語ターゲット設定が可能です。

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

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

 

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

 
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'
        }
    }
}
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: 'デジタルヒューマンを非表示'
        }
    }
}

言語置換

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

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

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

複数言語の置換:

 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'
        }
    }
}
お役に立ちましたか?
😞
😐
🤩

最終更新日 February 6, 2025