📑 그누보드

그누보드 <분류> 다국어 설정

(。θᗨθ。) 2022. 3. 7. 00:14

2022.03.07 - [🪄스크립트] - 다국어

다국어 설정을 미리 해야함(쿠키)

 

<?php
//쿠키얻기
$getCookieLang = $_COOKIE["clickedlanguage"];

$thisURL = $_SERVER['REQUEST_URI'];

if($getCookieLang === "ko"){  //한국어  
} else if($getCookieLang === "en") { 	//영어 
    echo "
    <script>
        document.querySelector('#bo_cate ul li:nth-child(1) a').textContent = 'Total';
        document.querySelector('#bo_cate ul li:nth-child(2) a').textContent = 'Wood';
        document.querySelector('#bo_cate ul li:nth-child(3) a').textContent = 'Steel';
        document.querySelector('#bo_cate ul li:nth-child(4) a').textContent = 'Other';
        
        const liEl = document.querySelectorAll('#gall_ul li');
        liEl.forEach( (ele, i) => {
            let j = i + 1
            let text = document.querySelector('#gall_ul li:nth-child(' + j + ') .bo_cate_link ');

            if(text.textContent === '철재'){
                text.textContent = 'Steel'
            } else if(text.textContent === '목재'){
                text.textContent = 'Wood'
            } else if(text.textContent === '기타'){
                text.textContent = 'Other'
            }
        })

    </script>";
    
} else if($getCookieLang === "jp") { 	//일어 
    echo "
    <script>
        document.querySelector('#bo_cate ul li:nth-child(1) a').textContent = '全体';
        document.querySelector('#bo_cate ul li:nth-child(2) a').textContent = '木材';
        document.querySelector('#bo_cate ul li:nth-child(3) a').textContent = '鉄材';
        document.querySelector('#bo_cate ul li:nth-child(4) a').textContent = 'その他';

        const liEl = document.querySelectorAll('#gall_ul li');
        liEl.forEach( (ele, i) => {
            let j = i + 1
            let text = document.querySelector('#gall_ul li:nth-child(' + j + ') .bo_cate_link ');

            if(text.textContent === '철재'){
                text.textContent = '鉄材'
            } else if(text.textContent === '목재'){
                text.textContent = '木材'
            } else if(text.textContent === '기타'){
                text.textContent = 'その他'
            }
        })
    </script>";

};
?>
728x90