Updated
This commit is contained in:
53
master/examples/common.html
Normal file
53
master/examples/common.html
Normal file
@@ -0,0 +1,53 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>require.js: Common I18N Test</title>
|
||||
<script type="text/javascript">
|
||||
requirejsArgs= {
|
||||
dojoLocation:"../../../../.."
|
||||
};
|
||||
</script>
|
||||
<script type="text/javascript" src="../requirejs-setup.js"></script>
|
||||
<script type="text/javascript" src="../../../../../dojo.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(["dojo"], function(dojo){
|
||||
// dojo/i18n! looks at dojo.locale
|
||||
locale && (dojo.locale= locale);
|
||||
require(
|
||||
["commonA", "commonB", "doh"],
|
||||
function(commonA, commonB, doh) {
|
||||
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>
|
||||
Reference in New Issue
Block a user