can
Version:
MIT-licensed, client-side, JavaScript framework that makes building rich web applications easy.
54 lines (52 loc) • 1.61 kB
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>