• 25-11-2022, 11:12:37
    #1
    Merhaba arkadaşlar aşağıdaki kod ile dil değiştirme yapılmış "langs" klasörü içerisinde TR ve US arıyor sanırım bu dosyaların içeriği nasıl olmalı dilleri çekebilmem için yardımcı olabilecek var mı

                        <div class="langbar">
                            <a id="trLan" onclick="changeLanguage('TR')">
                                <img width="32" src="images/tr.png" alt="Türkçe">
                            </a>
                            <a id="enLan" onclick="changeLanguage('EN')">
                                <img width="32" src="images/us.png" alt="English">
                            </a>
                        </div>
    function changeLanguage(id) {
    
        myQuery = $.ajax({
            type: 'GET',
            url: '/langs/' + id,
            dataType: "text",
            async: false,
            contentType: "text/html; charset=utf-8",
            success: function (result) {
                location.reload();
            },
            error: function (result) {
                //console.log("error");
            }
        });
    
        setCookie("Lang",id);
    }
    
    function getCookie(name) {
        const value = `; ${document.cookie}`;
        const parts = value.split(`; ${name}=`);
        if (parts.length === 2) return parts.pop().split(';').shift();
    }
      
    function setCookie(name,value) {
        var expires = "";
        
            var date = new Date();
            date.setTime(date.getTime() + (7*24*60*60*1000));
            expires = "; expires=" + date.toUTCString();
        
        document.cookie = name + "=" + (value || "")  + expires + "; path=/";
    }
  • 25-11-2022, 22:58:18
    #2
    Yok mu bilen