| 2150 | 
           mathias | 
           1 | 
           <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
  | 
        
        
            | 
            | 
           2 | 
           	"http://www.w3.org/TR/html4/strict.dtd">
  | 
        
        
            | 
            | 
           3 | 
           <html>
  | 
        
        
            | 
            | 
           4 | 
           	<head>
  | 
        
        
            | 
            | 
           5 | 
           		<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  | 
        
        
            | 
            | 
           6 | 
           		<title>Dojo Globalization Hello World</title>
  | 
        
        
            | 
            | 
           7 | 
              | 
        
        
            | 
            | 
           8 | 
           		<script language="JavaScript" type="text/javascript">
  | 
        
        
            | 
            | 
           9 | 
           			// set the global locale for Dojo from the request parameter
  | 
        
        
            | 
            | 
           10 | 
           			var result = location.href.match(/[\?\&]locale=([^\&]+)/);
  | 
        
        
            | 
            | 
           11 | 
           			djConfig = {locale: result && result[1] || "en-us"}; // default locale is en-us
  | 
        
        
            | 
            | 
           12 | 
           	 	</script>
  | 
        
        
            | 
            | 
           13 | 
              | 
        
        
            | 
            | 
           14 | 
           		<script type="text/javascript" src="../../dojo/dojo.js"></script>
  | 
        
        
            | 
            | 
           15 | 
              | 
        
        
            | 
            | 
           16 | 
           		<style type="text/css">
  | 
        
        
            | 
            | 
           17 | 
           	 		@import "../../dojo/resources/dojo.css";
  | 
        
        
            | 
            | 
           18 | 
           			@import "../themes/tundra/tundra.css";
  | 
        
        
            | 
            | 
           19 | 
           			@import "../themes/tundra/tundra_rtl.css";
  | 
        
        
            | 
            | 
           20 | 
              | 
        
        
            | 
            | 
           21 | 
           			body {padding:1em}
  | 
        
        
            | 
            | 
           22 | 
           		</style>
  | 
        
        
            | 
            | 
           23 | 
              | 
        
        
            | 
            | 
           24 | 
           		<script language="JavaScript" type="text/javascript">
  | 
        
        
            | 
            | 
           25 | 
           			dojo.require("dojo.date.locale");
  | 
        
        
            | 
            | 
           26 | 
           			dojo.require("dojo.number");
  | 
        
        
            | 
            | 
           27 | 
           			dojo.require("dojo.string");
  | 
        
        
            | 
            | 
           28 | 
           			dojo.require("dojo.parser");
  | 
        
        
            | 
            | 
           29 | 
           			dojo.require("dijit.form.DateTextBox");
  | 
        
        
            | 
            | 
           30 | 
              | 
        
        
            | 
            | 
           31 | 
           			// load the resource bundle for HelloWorld
  | 
        
        
            | 
            | 
           32 | 
           			dojo.requireLocalization("dijit.demos.nihao", "helloworld");
  | 
        
        
            | 
            | 
           33 | 
              | 
        
        
            | 
            | 
           34 | 
           			var resourceBundle;
  | 
        
        
            | 
            | 
           35 | 
              | 
        
        
            | 
            | 
           36 | 
           			dojo.addOnLoad(function(){
  | 
        
        
            | 
            | 
           37 | 
           				// create the DateTextBox from the HTML segment with the dojoType set
  | 
        
        
            | 
            | 
           38 | 
           				dojo.parser.parse();
  | 
        
        
            | 
            | 
           39 | 
              | 
        
        
            | 
            | 
           40 | 
           				// make current locale selected
  | 
        
        
            | 
            | 
           41 | 
           				dojo.byId('langList').value = dojo.locale;
  | 
        
        
            | 
            | 
           42 | 
              | 
        
        
            | 
            | 
           43 | 
           				// get the resource bundle object of the current global locale
  | 
        
        
            | 
            | 
           44 | 
           				resourceBundle = dojo.i18n.getLocalization("dijit.demos.nihao", "helloworld");
  | 
        
        
            | 
            | 
           45 | 
              | 
        
        
            | 
            | 
           46 | 
           				// do formatting and update the resource strings
  | 
        
        
            | 
            | 
           47 | 
           				dojo.byId('locale').innerHTML = resourceBundle.localeSelect;
  | 
        
        
            | 
            | 
           48 | 
           				dojo.byId('content').innerHTML = dojo.string.substitute(
  | 
        
        
            | 
            | 
           49 | 
           					resourceBundle.contentStr,
  | 
        
        
            | 
            | 
           50 | 
           					[dojo.date.locale.format(new Date(), {selector:'date', formatLength:'long'})]);
  | 
        
        
            | 
            | 
           51 | 
           				dojo.byId('date').innerHTML = resourceBundle.dateSelect;
  | 
        
        
            | 
            | 
           52 | 
              | 
        
        
            | 
            | 
           53 | 
           				dateChanged();
  | 
        
        
            | 
            | 
           54 | 
           			});
  | 
        
        
            | 
            | 
           55 | 
              | 
        
        
            | 
            | 
           56 | 
           			function localeChanged(){
  | 
        
        
            | 
            | 
           57 | 
           				open("nihao.html?locale=" + dojo.byId("langList").value, "_self");
  | 
        
        
            | 
            | 
           58 | 
           			}
  | 
        
        
            | 
            | 
           59 | 
              | 
        
        
            | 
            | 
           60 | 
           			function dateChanged(){
  | 
        
        
            | 
            | 
           61 | 
           				if(resourceBundle){
  | 
        
        
            | 
            | 
           62 | 
           					dojo.byId('secondsToGo').innerHTML = dojo.string.substitute(
  | 
        
        
            | 
            | 
           63 | 
           						resourceBundle.dateStr,
  | 
        
        
            | 
            | 
           64 | 
           						[dojo.number.format((dijit.byId("dateBox").getValue() - new Date()) / 1000)]);
  | 
        
        
            | 
            | 
           65 | 
           				}
  | 
        
        
            | 
            | 
           66 | 
           			}
  | 
        
        
            | 
            | 
           67 | 
           		</script>
  | 
        
        
            | 
            | 
           68 | 
           	</head>
  | 
        
        
            | 
            | 
           69 | 
              | 
        
        
            | 
            | 
           70 | 
           	<body class="tundra">
  | 
        
        
            | 
            | 
           71 | 
           		<h1>Dojo Globalization Hello World</h1>
  | 
        
        
            | 
            | 
           72 | 
           		<p>
  | 
        
        
            | 
            | 
           73 | 
           			<span id="locale"></span>
  | 
        
        
            | 
            | 
           74 | 
           			<select id="langList" onchange="localeChanged();" >
  | 
        
        
            | 
            | 
           75 | 
           				<option value="en-us">en-US</option>
  | 
        
        
            | 
            | 
           76 | 
           				<option value="fr-fr">fr-FR</option>
  | 
        
        
            | 
            | 
           77 | 
           				<option value="zh-cn">zh-CN</option>
  | 
        
        
            | 
            | 
           78 | 
           			</select>
  | 
        
        
            | 
            | 
           79 | 
           		</p>
  | 
        
        
            | 
            | 
           80 | 
           		<hr>
  | 
        
        
            | 
            | 
           81 | 
           		<p id="content"></p>
  | 
        
        
            | 
            | 
           82 | 
           		<p>
  | 
        
        
            | 
            | 
           83 | 
           			<span id="date"></span>
  | 
        
        
            | 
            | 
           84 | 
           			<input id="dateBox" type="text" dojoType="dijit.form.DateTextBox" constraints="{formatLength:'long'}" onchange="dateChanged();">
  | 
        
        
            | 
            | 
           85 | 
           		</p>
  | 
        
        
            | 
            | 
           86 | 
           		<p id="secondsToGo"></p>
  | 
        
        
            | 
            | 
           87 | 
           	</body>
  | 
        
        
            | 
            | 
           88 | 
           </html>
  |