1 | define(["doh/main", "../has", "../i18n", "require"], function(doh, has, i18n, require){
|
2 | var
|
3 | getAsyncTest = function(value, locale){
|
4 | return function(){
|
5 | var def = new doh.Deferred();
|
6 | require([i18n.getL10nName("dojo/testsDOH", "salutations", locale)], function(bundle){
|
7 | doh.assertEqual(value, bundle.hello);
|
8 | def.callback(true);
|
9 | });
|
10 | return def;
|
11 | };
|
12 | },
|
13 |
|
14 | getSyncTest = function(value, locale){
|
15 | return function(){
|
16 | doh.assertEqual(value, i18n.getLocalization("dojo/testsDOH", "salutations", locale).hello);
|
17 | };
|
18 | },
|
19 |
|
20 | getFixture = function(locale, value){
|
21 | return {
|
22 | name: "salutations-"+locale,
|
23 | timeout: 2000,
|
24 | runTest: (require.async ? getAsyncTest : getSyncTest)(value, locale)
|
25 | };
|
26 | },
|
27 |
|
28 | testSet = [
|
29 |
|
30 | getFixture("de", "Hallo"),
|
31 |
|
32 | getFixture("en", "Hello"),
|
33 |
|
34 | getFixture("en-au", "G'day"),
|
35 |
|
36 | getFixture("en-us", "Hello"),
|
37 |
|
38 | getFixture("en-us-texas", "Howdy"),
|
39 |
|
40 | getFixture("en-us-new_york", "Hello"),
|
41 |
|
42 | getFixture("en-us-new_york-brooklyn", "Yo"),
|
43 |
|
44 | getFixture("xx", "Hello"),
|
45 |
|
46 | getFixture("zh-cn", "\u4f60\u597d")
|
47 | ];
|
48 |
|
49 |
|
50 | doh.register("testsDOH.i18n", testSet);
|
51 | if(has("host-browser")){
|
52 | doh.register("testsDOH.i18n.extra.sync", require.toUrl("./i18n.html"), {async:0});
|
53 | doh.register("testsDOH.i18n.extra.async", require.toUrl("./i18n.html"), {async:1});
|
54 | }
|
55 | });
|