表示文字列(多言語対応)
ホステッドエクスペリエンスでユーザーに表示されるテキストを更新することができます。これは、ユーザーのブラウザ設定に基づいて特定の言語のエクスペリエンスを提供したり、ブランドやユーザーエクスペリエンスに合わせてテキストをカスタマイズしたりするために行うことができます。
これを行うには、languageStrings
プロパティを定義し、ホステッドエクスペリエンスインターフェース内で表示されるテキストを更新します。languageStrings
オブジェクトには、ISO-639-1言語(例:en
、es
、ja
など)に対応する値が含まれている必要があります。各言語コード値には、更新したい値のキーを含むオブジェクトを提供します。また、特定のロケール/地域(例:en-US
、en-GB
、de-DE
、pt-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',
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...'
}
}
}
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
を以下のように置き換えることができます:
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',
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.'
}
}
}
最終更新日 May 15, 2025