Irrelon / jquery-lang-js

i18n Allow instant language switching on HTML pages without reloading the page.
https://www.irrelon.com
363 stars 132 forks source link

Multiple language question? #64

Closed raysefo closed 7 years ago

raysefo commented 8 years ago

Hi,

I have a web page with Turkish language default. I would like to switch it to English when user clicks button. For translation parts, I wrote in Turkish as follows:

 <p lang="tr">ÇOK YAKINDA</p>

But when I click the English button, it does NOT translate.

<div class="lang">
        <a href="#turkish" onclick="window.lang.change('tr'); return false;"><img src="images/turkey-icon.png" alt="Türkçe" ></a>
        <a href="#english" onclick="window.lang.change('en'); return false;"><img src="images/uk-icon.png" alt="English" ></a>

    </div>

Here is my token:

<script type="text/javascript">
        window.lang = new Lang('tokens', 'tr');
    </script>

And my nonDynamic.js:

Lang.prototype.pack.en = {
    "token": {
        "İLETİŞİM": "CONTACT",
        "TAGLINE": "We Provide <br><span>Connected Intelligence</span> <br>For A <span>Smart World.</span>",
        "BİZ": "We are ",
        "NESNELERİN İNTERNETİ (IOT)": "IOTERM",
        "ÇÖZÜMLERİ": "INTERNET OF THINGS (IOT)",
        "ŞİRKETİYİZ,": "Solutions",
        "BİZ IOTERM'ÜZ": "Company",
        "DAHA İYİ": "We Provide",
        "BİR DÜNYA İÇİN": "Connected Intelligence",
        "BÜTÜNLEŞİK BİLGİ": "For A",
        "SAĞLIYORUZ.": "Smart World",
        "ÇOK YAKINDA": "We are Coming",
        "GELİYORUZ": "Really Soon",
        "BİZE E-POSTA GÖNDEREBİLİR VEYA AŞAĞIDAKİ FORMU DOLDURABİLSİNİZ. SİZE EN KISA SÜREDE GERİ DÖNÜŞ YAPACAĞIZ.": "Just want to say hello? Send us an email or fill out the form below and we will get back to you ASAP.",
        "Türkiye": "Turkey",
        "ABD": "USA",
        "Adınız": "Your name",
        "E-posta adresiniz": "Email address",
        "Telefon numaranız": "Phone",
        "Sorunuz": "Your question",
        "GÖNDER": "Send"
    }
};

Why it is NOT switching?

raysefo commented 8 years ago

changing this

window.lang = new Lang('tokens', 'tr');

to this works!

var lang = new Lang('tr');
kevkha commented 8 years ago

Thanks for reporting. It's a doc error. I've corrected in my branch. Pull request #61.