Skip to content

Commit c0781b4

Browse files
committed
Added example for multiple language pack loads.
1 parent 6aa4cd4 commit c0781b4

File tree

3 files changed

+31
-0
lines changed

3 files changed

+31
-0
lines changed
+27
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
2+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
3+
4+
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
5+
6+
<head>
7+
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
8+
<title>Localize Test</title>
9+
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.5.2/jquery.min.js" type="text/javascript" charset="utf-8"></script>
10+
<script src="../../build/jquery.localize.js" type="text/javascript" charset="utf-8"></script>
11+
</head>
12+
13+
<body>
14+
<h1>Test localization...</h1>
15+
<p data-localize="header_message">Header failed to load.</p>
16+
<p data-localize="footer_message">Footer failed to load.</p>
17+
<script type="text/javascript" charset="utf-8">
18+
$(function(){
19+
var opts = { language: "en", pathPrefix: "../lang" };
20+
$("[data-localize]")
21+
.localize("header", opts)
22+
.localize("footer", opts);
23+
});
24+
</script>
25+
</body>
26+
27+
</html>

test/lang/footer-en.json

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
{ "footer_message": "Footer message loaded" }
2+

test/lang/header-en.json

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
{ "header_message": "Header message loaded" }
2+

0 commit comments

Comments
 (0)