JavaScript Tutorial/Dojo toolkit/I18N Locale
Calendar in Chinese
<html>
<head>
<link rel="StyleSheet" type="text/css" href="js/dojo/dojo/resources/dojo.css">
<link rel="StyleSheet" type="text/css" href="js/dojo/dijit/themes/tundra/tundra.css">
<script type="text/javascript">
var djConfig = {
baseScriptUri : "js/dojo/",
parseOnLoad : true,
extraLocale: ["en-us", "zh-cn"]
};
</script>
<script type="text/javascript" src="js/dojo/dojo/dojo.js"></script>
<script language="JavaScript" type="text/javascript">
dojo.require("dojo.parser");
dojo.require("dijit._Calendar");
</script>
</head>
<body class="tundra">
<input id="calChinese" dojoType="dijit._Calendar" lang="zh-cn" />
</body>
</html>
Get button text from predefined locale
<html>
<head>
<script type="text/javascript">
var djConfig = {
baseScriptUri : "js/dojo/"
};
</script>
<script type="text/javascript" src="js/dojo/dojo/dojo.js"></script>
<script language="JavaScript" type="text/javascript">
dojo.require("dojo.i18n");
dojo.requireLocalization("dijit", "common",dojo.i18n.normalizeLocale("fr"));
alert(dojo.i18n.getLocalization("dijit", "common",dojo.i18n.normalizeLocale("fr")).buttonOk);
alert(dojo.i18n.getLocalization("dijit", "common",dojo.i18n.normalizeLocale("fr")).buttonCancel);
dojo.requireLocalization("dijit", "common",dojo.i18n.normalizeLocale("zh"));
alert(dojo.i18n.getLocalization("dijit", "common",dojo.i18n.normalizeLocale("zh")).buttonOk);
alert(dojo.i18n.getLocalization("dijit", "common",dojo.i18n.normalizeLocale("zh")).buttonCancel);
</script>
</head>
<body></body>
</html>
Load predefined locale
<html>
<head>
<script type="text/javascript">
var djConfig = {
baseScriptUri : "js/dojo/"
};
</script>
<script type="text/javascript" src="js/dojo/dojo/dojo.js"></script>
<script language="JavaScript" type="text/javascript">
dojo.require("dojo.i18n");
dojo.requireLocalization("dijit", "common",dojo.i18n.normalizeLocale("fr"));
alert(dojo.i18n.getLocalization("dijit", "common",dojo.i18n.normalizeLocale("fr")).buttonOk);
alert(dojo.i18n.getLocalization("dijit", "common",dojo.i18n.normalizeLocale("fr")).buttonCancel);
dojo.requireLocalization("dijit", "common",dojo.i18n.normalizeLocale("zh"));
alert(dojo.i18n.getLocalization("dijit", "common",dojo.i18n.normalizeLocale("zh")).buttonOk);
alert(dojo.i18n.getLocalization("dijit", "common",dojo.i18n.normalizeLocale("zh")).buttonCancel);
</script>
</head>
<body></body>
</html>