Error 404 thrown when trying to load language pack
Closed this issue ยท 4 comments
Hi,
I am using your example files for testing switching langs,
but there're some problems happended to me.
-
when i click "Switch to Thai" ,
there's nothing happened and
the console just throw an error as below :
-
I'd added a "switch to TW"
<a>
tag on index.html in example files,
after i clicking it
nothing happened, too,
and the error msg as below:
-
but it's work fine while i use the nonDynamic.js.
so, sounds like the problem is the something trouble with json.
this is my edited index.html from your example files :
(the only one different is i'd added one more <a>
tag in #langChanger )
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<title>jQuery Lang JS Module Test Page</title>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js" type="text/javascript"></script>
<script src="js/js.cookie.js" charset="utf-8" type="text/javascript"></script>
<script src="js/jquery-lang.js" charset="utf-8" type="text/javascript"></script>
<!--<script src="js/langpack/nonDynamic.js" charset="utf-8" type="text/javascript"></script>-->
<script type="text/javascript">
var lang = new Lang();
lang.dynamic('th', 'js/langpack/th.json');
lang.init({
defaultLang: 'en'
});
</script>
<style>
body {
font-family: Verdana, Geneva, sans-serif;
font-size: 12px;
}
#langChanger {
margin-bottom: 10px;
}
.sectionTitle {
font-weight: bold;
font-size: 14px;
margin-bottom: 10px;
}
</style>
</head>
<body>
<a href="http://flattr.com/thing/352558/jQuery-Multi-Language-Site-Plugin" target="_blank">
<img src="http://api.flattr.com/button/flattr-badge-large.png" alt="Flattr this" title="Flattr this"
border="0"/></a><BR/><BR/>
<div id="langChanger">
<a href="#" onclick="window.lang.change('en'); return false;">Switch to English</a>
|
<a href="#" onclick="window.lang.change('th'); return false;">Switch to Thai</a></div>
|
<a href="#" onclick="window.lang.change('tw'); return false;">Switch to TW</a></div>
</div>
<div id="testHtml">
<div id="searchTitle" class="sectionTitle" lang="en">Property Search</div>
<div id="searchForm">
<form action="/api/search" method="post" enctype="multipart/form-data">
<table>
<tr>
<td><span lang="en">Location</span>:</td>
</tr>
<tr>
<td><input type="text" name="location"/></td>
</tr>
</table>
</form>
</div>
</div>
</body>
</html>
Any help will be greatly appreciated.
Please let me know how to fix it.
Thanks for your help,
Wesley
Hi Wesley, as you can see from the error in the console, the browser cannot find the JSON file under the path lang/js/langpack/th.json
Are you sure it is available from that path?
Are you running this over your file system or via a web server?
Hi, Irrelon,
I just Moved all the files from my company sever site to my personal site about 5 mins ago.
and all of those were work fine.....
sorry about all of these...
Thanks for your help. ^^"