M

ALX DESIGN

HOME / JAVASCRIPT /

Dalenys payment solution - How to add custom languages on your payment form template

The Dalenys payment solution allows to display a payment form in 10 default languages, however it is possible to change the fields labels to create additional translations.

Here is an example to add japanese language, add this code just before the </head> closing tag :

<script type="text/javascript">

    function translateB2B(lang) {
        // JAPANESE / 日本語
        if( lang == 'JP' ) {
            // Card number
            if( document.getElementById('b2b-ccnum') ) {
                // label
                document.getElementById('b2b-ccnum').firstElementChild.innerHTML='カードコード';
                // error
                document.getElementById('b2b-CARDCODE-errors').firstElementChild.innerHTML='無効なカードコード';
            }

            // Expiry
            if( document.getElementById('b2b-expiration-date') ) {
                // label
                document.getElementById('b2b-expiration-date').firstElementChild.innerHTML='有効期限';
                // error
                document.getElementById('b2b-YEARDATE-errors').firstElementChild.innerHTML='無効な有効期限';
            }

            // Card verification code (CVV / CVC)
            if( document.getElementById('b2b-cvv') ) {
                // label
                document.getElementById('b2b-cvv').firstElementChild.innerHTML='CVV';
                // comment
                document.getElementById('b2b-CARDCVV-comment').firstElementChild.innerHTML='カード番号の後に出現する3桁の番号。';
                // For American Express card only : document.getElementById("b2b-cvv-comment").innerHTML='カード番号の上に表示される4桁の数字。'; // comment Amex
                // error
                document.getElementById('b2b-CARDCVV-errors').firstElementChild.innerHTML='無効なCVV';
            }

            // Cardholder full name
            if( document.getElementById('b2b-fullname') ) {
                // label
                document.getElementById('b2b-fullname').firstElementChild.innerHTML='フルネーム';
                // error
                document.getElementById('b2b-CARDFULLNAME-errors').firstElementChild.innerHTML='行方不明のフルネーム';
            }

            // Cardholder email
            if( document.getElementById('b2b-email') ) {
                // label
                document.getElementById('b2b-email').firstElementChild.innerHTML='メールアドレス';
                // error
                document.getElementById('b2b-CLIENTEMAIL-errors').firstElementChild.innerHTML='無効な電子メールアドレス';
            }

            // Submit button
            if( document.getElementById('b2b-submit') ) {
                // Button's text
                document.getElementById('b2b-submit').value='Ok';
            }

            // Cancel button
            if( document.getElementById('b2b-cancel') ) {
             // Button's text
                document.getElementById('b2b-cancel').value='キャンセル';
            }
        }
    }
</script>

Add an onload event on your <body> tag to trigger the translation :

<body onload="translateB2B('JP')">

BACK TO HOME

Leave a comment ?