Eメールサブスクリプション設定ページを多言語化する
サブスクリプション自体は多言語対応のための設定が用意されていますが、HubLタブから出力されるその他のテキストやボタン文言やテンプレートで制御しなければなりません。
しかしこれらの設定ページはウェブサイトページなどと違い多言語化の仕組みがないため、リクエストヘッダーを参照して表示する言語の切り替えを行います。またこれらのタグをラップするグローバルカスタムモジュールを作成することで、コンテンツをクライアントが変更しやすいように作ることもできます。
email_subscriptionsタグ
{%- set jaOK = request.headers['accept-language'] is string_containing 'ja' -%}
{%- set button_text = jaOK
? 'メール配信設定を更新'
: 'Update email delivery settings'
-%}
{%- set header = jaOK
? 'メール配信設定'
: 'Email Delivery Settings'
-%}
{%- set resubscribe_button_text = jaOK
? 'メール配信設定が正常に更新されました。'
: 'Email delivery settings have been successfully updated.'
-%}
{%- set subheader_text = jaOK
? 'このメールアドレスにお心当たりがない場合は、このページを無視してください。'
: 'If you do not recognize this e-mail address, please ignore this page.'
-%}
{%- set unsubscribe_all_option = jaOK
? '全てのメールを配信停止する'
: 'Unsubscribe from all emails'
-%}
{%- set unsubscribe_all_text = jaOK
? '全てのメールを受信しない場合は、こちらにチェックをいれてください。'
: 'If you do not wish to receive all emails, please check here.'
-%}
{%- set unsubscribe_all_unsubbed_text = jaOK
? '現在、全てのメールの購読を解除しています。もう一度メールを受け取りますか?'
: 'You are currently unsubscribed from all emails. Would you like to receive them again?'
-%}
{%- set unsubscribe_single_text = jaOK
? '今後も受信を継続するメールにチェックをいれ、更新ボタンをクリックしてください。'
: 'Check the boxes for the emails you would like to continue receiving and click the Update button.'
-%}
{%- set label = jaOK
? 'サブスクリプション設定'
: 'Subscription Preferences'
-%}
{%- email_subscriptions
"email_subscriptions"
button_text="{{ button_text }}",
header="{{ header }}",
resubscribe_button_text="{{ resubscribe_button_text }}",
subheader_text="{{ subheader_text }}",
unsubscribe_all_option="{{ unsubscribe_all_option }}",
unsubscribe_all_text="{{ unsubscribe_all_text }}",
unsubscribe_all_unsubbed_text="{{ unsubscribe_all_unsubbed_text }}",
unsubscribe_single_text="{{ unsubscribe_single_text }}",
label="{{ label }}",
-%}
email_subscriptions_confirmationタグ
{%- set jaOK = request.headers['accept-language'] is string_containing 'ja' -%}
{%- set header = jaOK
? 'メール配信停止'
: 'Email Unsubscribe'
-%}
{%- set subheader_text = jaOK
? 'もし、これがあなたのメールアドレスでない場合は、このページに関連するメールはあなたに転送された可能性が高いので、このページを無視してください。'
: 'If this is not your email address, please ignore this page since the email associated with this page was most likely forwarded to you.'
-%}
{%- set unsubscribe_all_success = jaOK
? 'すべてのメール配信の停止に成功しました。'
: 'You have successfully unsubscribed from all email communications.'
-%}
{%- set subscription_update_success = jaOK
? 'メール設定の更新が完了しました。'
: 'You have successfully updated your email preferences.'
-%}
{%- set label = jaOK
? 'サブスクリプションの更新確認'
: 'Subscriptions Update Confirmation'
-%}
{%- email_subscriptions_confirmation
"email_subscriptions_confirmation"
header='{{ header }}',
subheader_text='{{ subheader_text }}',
unsubscribe_all_success='{{ unsubscribe_all_success }}',
subscription_update_success='{{ subscription_update_success }}',
label='{{ label }}',
-%}
email_simple_subscriptionタグ
{%- set jaOK = request.headers['accept-language'] is string_containing 'ja' -%}
{%- set header = jaOK
? 'メール配信停止'
: 'Email Unsubscribe'
-%}
{%- set input_help_text = jaOK
? 'Eメールアドレス:'
: 'Your email address:'
-%}
{%- set button_text = jaOK
? '配信停止'
: 'Unsubscribe'
-%}
{%- set label = jaOK
? 'バックアップの解除'
: 'Backup Unsubscribe'
-%}
{%- email_simple_subscription
"email_simple_subscription"
header='{{ header }}',
input_help_text='{{ input_help_text }}',
button_text='{{ button_text }}',
label='{{ label }}',
input_placeholder='email@example.com',
-%}



