You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
65 lines
2.4 KiB
65 lines
2.4 KiB
<html> |
|
<head> |
|
<title>testing i18n extra locales</title> |
|
<!-- gotta do this in a separate page since clearing all the caches in the loader and dojo/i18n is too error-prone --> |
|
|
|
<script type="text/javascript"> |
|
var dohArgs= (window.parent.doh && window.parent.doh.dohArgs) || {async:0}; |
|
var dojoConfig = { |
|
async:dohArgs.async, |
|
extraLocale:['en-us-hawaii', 'en-us-new_york-brooklyn'], |
|
has:{ |
|
"dojo-unit-tests":1 |
|
} |
|
}; |
|
</script> |
|
|
|
<script type="text/javascript" src="../dojo.js" data-dojo-config=""></script> |
|
|
|
<script type="text/javascript"> |
|
// the following should load the current locale + 'en-us-hawaii' and 'en-us-new_york-brooklyn |
|
require(["doh", "dojo/_base/array", "dojo/has", "dojo/i18n", "dojo/i18n!dojo/testsDOH/nls/salutations", "dojo/domReady!"], |
|
function(doh, array, has, i18n){ |
|
if(dohArgs.async){ |
|
doh.register(function extraLocalesAsync(t){ |
|
// the following should load synchronously...at least with the dojo loader |
|
var hawaii, ny; |
|
require(["dojo/i18n!dojo/testsDOH/nls/en-us-hawaii/salutations"], function(bundle){ hawaii = bundle;}); |
|
require(["dojo/i18n!dojo/testsDOH/nls/en-us-new_york-brooklyn/salutations"], function(bundle){ ny = bundle;}); |
|
t.is(hawaii.hello, "Aloha"); |
|
t.is(ny.hello, "Yo"); |
|
try{ |
|
var result = require("dojo/i18n!dojo/testsDOH/nls/ar/salutations"); |
|
t.f(true, "should have thrown"); |
|
}catch(e){ |
|
t.t(true); |
|
} |
|
}); |
|
}else{ |
|
doh.register(function extraLocalesSync(t){ |
|
t.is(i18n.getLocalization("dojo/testsDOH", "salutations", "en-us-hawaii").hello, "Aloha"); |
|
t.is(i18n.getLocalization("dojo/testsDOH", "salutations", "en-us-new_york-brooklyn").hello, "Yo"); |
|
try{ |
|
t.is(i18n.getLocalization("dojo/testsDOH", "salutations", "en-au").hello, "G'day"); |
|
}catch(e){ |
|
t.f("synchronous get should work if not xdomain"); |
|
} |
|
}); |
|
} |
|
|
|
doh.run(); |
|
}); |
|
if(!require.async){ |
|
dojo.requireLocalization("dojo.testsDOH._base.loader", "syncBundle", "ab-cd-ef"); |
|
dojo.requireLocalization("dojo.testsDOH._base.loader", "amdBundle", "ab-cd-ef"); |
|
doh.register(function oldAndNewBundleStyles(t){ |
|
t.is(dojo.i18n.getLocalization("dojo.testsDOH._base.loader", "syncBundle", "ab-cd-ef").syncBundle, "syncBundle-ab-cd-ef"); |
|
t.is(dojo.i18n.getLocalization("dojo.testsDOH._base.loader", "amdBundle", "ab-cd-ef").amdBundle, "amdBundle-ab-cd-ef"); |
|
}); |
|
} |
|
|
|
</script> |
|
</head> |
|
<body> |
|
</body> |
|
</html>
|
|
|