Skip to content

add the bower configuration #46

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
add unit test for the patch of issue #47
  • Loading branch information
Haixing-Hu committed Mar 8, 2015
commit f37ea239af040ab8eeed5d6b2ccc4439d88d98de
2 changes: 1 addition & 1 deletion dist/jquery.localize.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

24 changes: 24 additions & 0 deletions examples/language_country_code_directly.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">

<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<title>Localize Test</title>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.5.2/jquery.min.js" type="text/javascript" charset="utf-8"></script>
<script src="../dist/jquery.localize.min.js" type="text/javascript" charset="utf-8"></script>
</head>

<body>
<h1>Test localization...</h1>
<p data-localize="message">It failed :(</p>
<script type="text/javascript" charset="utf-8">
$(function(){
var opts = { language: "zh-CN", pathPrefix: "../test/lang"};
$("[data-localize]").localize("test", opts)
})
</script>
</body>

</html>
3 changes: 3 additions & 0 deletions test/lang/test-zh-CN.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"message": "language-country code success"
}
6 changes: 6 additions & 0 deletions test/localize_test.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,12 @@ do ($ = jQuery) ->
t.localize("test", opts)
equal t.text(), "country code success"

test "load language-country code json file directly", ->
opts = language: "zh-CN", pathPrefix: "lang"
t = localizableTagWithRel("p", "message", text: "language-country code fail")
t.localize("test", opts)
equal t.text(), "language-country code success"

module "Language optimization"

test "skipping language using string match", ->
Expand Down
12 changes: 12 additions & 0 deletions test/localize_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,18 @@
t.localize("test", opts);
return equal(t.text(), "country code success");
});
test("load language-country code json file directly", function() {
var opts, t;
opts = {
language: "zh-CN",
pathPrefix: "lang"
};
t = localizableTagWithRel("p", "message", {
text: "language-country code fail"
});
t.localize("test", opts);
return equal(t.text(), "language-country code success");
});
module("Language optimization");
test("skipping language using string match", function() {
var opts, t;
Expand Down