Irrelon / jquery-lang-js

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

Uncaught Attempt to change language to "th" but no language pack for that language is loaded! #139

Open gulaykulekci opened 2 years ago

gulaykulekci commented 2 years ago

Hi,

I'm getting error: Uncaught Attempt to change language to "th" but no language pack for that language is loaded!

My html codes like this :

<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">

<head>
    <meta http-equiv="cache-control" content="no-cache, must-revalidate, post-check=0, pre-check=0">
    <meta http-equiv="expires" content="0">
    <meta http-equiv="pragma" content="no-cache">

    <script src="/node_modules/jquery-lang-js/js/js.cookie.js" charset="utf-8" type="text/javascript"></script>
    <script src="/node_modules/jquery-lang-js/js/jquery-lang.js" charset="utf-8" type="text/javascript"></script>
    <!--<script src="js/langpack/nonDynamic.js" charset="utf-8" type="text/javascript"></script>-->

</head>

<body style="height: 100%;overflow-y: scroll;max-height: 100%;">
                                        <td class="thdr">
                                            <table class="tblFuels" style="width:100%;">
                                                <thead>
                                                    <tr>
                                                        <th lang="en" data-lang-token="tarih">tarih</th>
                                                        <th lang="en" data-lang-token="ilkseviye">ilkseviye</th>
                                                        <th lang="en" data-lang-token="sonseviye">sonseviye</th>
                                                        <th lang="en" data-lang-token="fark">fark</th>
                                                        <th lang="en" data-lang-token="kilometre">kilometre</th>
                                                        <th lang="en" data-lang-token="adres">adres</th>
                                                    </tr>
                                                </thead>
                                                <tbody id="aTbl"></tbody>
                                            </table>
                                        </td>         

    <script type="text/javascript" src="/spassets/journey-analize-report/js/mainscript.js"></script>
    <script type="text/javascript">
        var lang = new Lang();

        lang.dynamic('en', '/spassets/common/_langs/journey-analize-report-en.json');
        lang.dynamic('tr', '/spassets/common/_langs/journey-analize-report-tr.json');

        lang.init({
            defaultLang: 'en'
        });
    </script>
</body>

</html>

My language file:

{
    "token": {
        "yaziciyagonder": "Send to Printer",
        "hareketraporu": "Motion Report",
        "yoltarifi": "Way Direction",
        "seferanalizraporu": "Voyage Analysis Report",
        "plaka": "Plate",
        "marka": "Trademark / Mark ",
        "surucu": "Driver",
        "tarih": "Date",
        "kilometre": "Kilometer",
         }
}
Irrelon commented 2 years ago

Hey ya! Are you able to put up a minimum proof of error online so I can take a look and debug?

JayDew commented 1 year ago

I also get the same error

Irrelon commented 1 year ago

I also get the same error

Same request, are you able to put up a minimum proof of error online so I can take a look and debug?