3.0 source code

This commit is contained in:
agolybev
2015-04-28 17:59:00 +03:00
parent c69fd34bdd
commit 7b3b2248e5
16311 changed files with 1445974 additions and 3108429 deletions

View File

@@ -0,0 +1,55 @@
<!DOCTYPE html>
<html>
<head>
<title>require.js: Common I18N Test</title>
<script type="text/javascript" src="../../require.js"></script>
<script type="text/javascript" src="../doh/runner.js"></script>
<script type="text/javascript" src="../doh/_browserRunner.js"></script>
<script type="text/javascript">
//Allow locale to be set via query args.
var locale = null;
var query = location.href.split("#")[0].split("?")[1];
var match = query && query.match(/locale=([\w-]+)/);
if (match) {
locale = match[1];
}
var red = "red";
var blue = "blue";
if (locale && locale.indexOf("en-us-surfer") != -1) {
red = "red, dude";
} else if ((locale && locale.indexOf("fr-") != -1)) {
red = "rouge";
blue = "bleu";
}
require({
config: {
'i18n': {
locale: locale
}
},
baseUrl: "./",
paths: {
i18n: "../../../i18n/i18n"
}
},
["commonA", "commonB"],
function(commonA, commonB) {
doh.register(
"commoni18n",
[
function commoni18n(t) {
t.is(red, commonA);
t.is(blue, commonB);
}
]
);
doh.run();
});
</script>
</head>
<body>
<h1>Common i18n bundle test</h1>
<p>This page tests for an i18n plugin resource that is specified by two different modules.</p>
</body>
</html>

View File

@@ -0,0 +1,3 @@
define(['i18n!nls/colors'], function (colors) {
return colors.red;
});

View File

@@ -0,0 +1,3 @@
define(['i18n!nls/colors'], function (colors) {
return colors.blue;
});

View File

@@ -0,0 +1,86 @@
<!DOCTYPE html>
<html>
<head>
<title>require.js: I18N Test</title>
<script type="text/javascript" src="../../require.js"></script>
<script type="text/javascript" src="../doh/runner.js"></script>
<script type="text/javascript" src="../doh/_browserRunner.js"></script>
<script type="text/javascript">
//Allow locale to be set via query args.
var locale = null;
var query = location.href.split("#")[0].split("?")[1];
var match = query && query.match(/locale=([\w-]+)/);
if (match) {
locale = match[1];
}
//Allow bundle name to be loaded via query args.
var bundle = "i18n!nls/colors";
match = query && query.match(/bundle=([^\&]+)/);
if (match) {
bundle = match[1];
}
var expected = {
red: "red",
blue: "blue",
green: "green",
black: {
opacity: 1,
rgb: {
r: "0",
g: "0",
b: "0"
}
}
};
var opacity = 1;
if (locale && locale.indexOf("en-us-surfer") != -1 || bundle.indexOf("nls/en-us-surfer/colors") != -1) {
expected.red = "red, dude";
expected.black.opacity = 0.5;
} else if ((locale && locale.indexOf("fr-") != -1) || bundle.indexOf("fr-") != -1) {
expected.red = "rouge";
expected.blue = "bleu";
}
require({
config: {
'i18n': {
locale: locale
}
},
baseUrl: "./",
paths: {
i18n: "../../../i18n/i18n"
}
},
[bundle],
function(actual) {
doh.register(
"i18n",
[
{
name: "simple structure",
runTest: function (t) {
t.is(expected.red, actual.red);
t.is(expected.blue, actual.blue);
t.is(expected.green, actual.green);
}
},
{
name: "complex structure",
runTest: function (t) {
t.is(expected.black, actual.black);
}
}
]
);
doh.run();
});
</script>
</head>
<body>
<h1>i18n bundle test</h1>
<p>This page tests the i18n bundling in require.js. You can change the locale to use by passing locale= or bundle=</p>
</body>
</html>

View File

@@ -0,0 +1,17 @@
define({
"root": {
red: "red",
blue: "blue",
green: "green",
black: {
opacity: 1,
rgb: {
r: "0",
g: "0",
b: "0"
}
}
},
"en-us-surfer": true,
"fr": true
});

View File

@@ -0,0 +1,6 @@
define({
red: "red, dude",
black: {
opacity: 0.5
}
});

View File

@@ -0,0 +1,4 @@
define({
red: "rouge",
blue: "bleu"
});

View File

@@ -0,0 +1,5 @@
//A sample module to use in the i18n build test.
define(["i18n!nls/colors"], function (colors) {
var red = colors.red;
});