Localization
http://msdn.microsoft.com/en-us/magazine/cc302030.aspx
http://msdn.microsoft.com/en-us/magazine/bb986108.aspx
Date.aspx
<%@ Page Language="C#" %>
<html>
<body>
<h1>
<% Response.Write (DateTime.Now.ToShortDateString ()); %>
</h1>
</body>
</html>
Global.asax
<%@ Import Namespace="System.Threading" %>
<%@ Import Namespace="System.Globalization" %>
<script language="C#" runat="server">
void Application_BeginRequest (Object sender, EventArgs e)
{
try {
if (Request.UserLanguages.Length > 0) {
Thread.CurrentThread.CurrentCulture =
CultureInfo.CreateSpecificCulture
(Request.UserLanguages[0]);
}
}
catch (ArgumentException) {
// Do nothing if CreateSpecificCulture fails
}
}
</script>
0 comments:
Post a Comment