source: Dev/branches/rest-dojo-ui/client/dojo/tests/i18n.html @ 256

Last change on this file since 256 was 256, checked in by hendrikvanantwerpen, 13 years ago

Reworked project structure based on REST interaction and Dojo library. As
soon as this is stable, the old jQueryUI branch can be removed (it's
kept for reference).

File size: 2.1 KB
Line 
1<html>
2        <head>
3                <title>testing i18n extra locales</title>
4                <!-- gotta do this in a separate page since clearing all the caches in the loader and dojo/i18n is too error-prone -->
5
6                <script type="text/javascript">
7                        var dohArgs= (window.parent.doh && window.parent.doh.dohArgs) || {async:0};
8                        var dojoConfig = {
9                                async:dohArgs.async,
10                                extraLocale:['en-us-hawaii', 'en-us-new_york-brooklyn']
11                        };
12                </script>
13
14                <script type="text/javascript" src="../dojo.js" data-dojo-config=""></script>
15
16                <script type="text/javascript">
17                // the following should load the current locale + 'en-us-hawaii' and 'en-us-new_york-brooklyn
18                require(["dojo", "doh", "dojo/i18n!dojo/tests/nls/salutations"], function(dojo, doh){
19                        if(dohArgs.async){
20                                doh.register(function extraLocalesAsync(t){
21                                        t.is(require("dojo/i18n!dojo/tests/nls/en-us-hawaii/salutations").hello, "Aloha");
22                                        t.is(require("dojo/i18n!dojo/tests/nls/en-us-new_york-brooklyn/salutations").hello, "Yo");
23                                        try{
24                                                var result = require("dojo/i18n!dojo/tests/nls/ar/salutations");
25                                                t.f(true, "should have thrown");
26                                        }catch(e){
27                                                t.t(true);
28                                        }
29                                });
30                        }else{
31                                doh.register(function extraLocalesSync(t){
32                                        t.is(dojo.i18n.getLocalization("dojo/tests", "salutations", "en-us-hawaii").hello, "Aloha");
33                                        t.is(dojo.i18n.getLocalization("dojo/tests", "salutations", "en-us-new_york-brooklyn").hello, "Yo");
34                                        try{
35                                                t.is(dojo.i18n.getLocalization("dojo/tests", "salutations", "en-au").hello, "G'day");
36                                        }catch(e){
37                                                t.f("synchronous get should work if not xdomain");
38                                        }
39                                });
40                        }
41                        doh.runOnLoad();
42                });
43                if(!require.async){
44                        dojo.requireLocalization("dojo.tests._base.loader", "syncBundle", "ab-cd-ef");
45                        dojo.requireLocalization("dojo.tests._base.loader", "amdBundle", "ab-cd-ef");
46                        doh.register(function oldAndNewBundleStyles(t){
47                                t.is(dojo.i18n.getLocalization("dojo.tests._base.loader", "syncBundle", "ab-cd-ef").syncBundle, "syncBundle-ab-cd-ef");
48                                t.is(dojo.i18n.getLocalization("dojo.tests._base.loader", "amdBundle", "ab-cd-ef").amdBundle, "amdBundle-ab-cd-ef");
49                        });
50                }
51                </script>
52        </head>
53        <body>
54        </body>
55</html>
Note: See TracBrowser for help on using the repository browser.