> > > What if you display CurrentUICulture ?
>
[quoted text clipped - 42 lines]
> I just tried setting CurrentUICulture to "da-DK", but with the same
> result..
I researched a little further:
If i insert the following code:
Response.Write("Language " + cultureInfo.Name + "<br />");
Response.Write("---------------------------------<br />");
Response.Write("CurrencySymbol " +
cultureInfo.NumberFormat.CurrencySymbol.ToString() + "<br />");
Response.Write("DateSeparator " +
cultureInfo.DateTimeFormat.DateSeparator + "<br />");
Response.Write("LongDatePattern " +
cultureInfo.DateTimeFormat.LongDatePattern.ToString() + "<br />");
Response.Write("ShortDatePattern " +
cultureInfo.DateTimeFormat.ShortDatePattern.ToString() + "<br />");
string[] days = cultureInfo.DateTimeFormat.DayNames;
for( int i = 0; i < days.Length; i++)
{
Response.Write(days[i] + "<br />");
}
Response.Write("---------------------------------<br />");
I get the following output:
Language da-DK
---------------------------------
CurrencySymbol $
DateSeparator /
LongDatePattern dddd, MMMM dd, yyyy
ShortDatePattern M/d/yyyy
s?ndag
mandag
tirsdag
onsdag
torsdag
fredag
l?rdag
In other words: Some of the values are perfect danish (the days) while
others are stille american (datepattern, dateseperator and
currencySymbol)
I am puzzled:)
Patrice - 31 Aug 2007 09:26 GMT
Yeah just random thoughts & tries for now...
What if you try a *Windows* .NET based application on the server that you'll
run under a regular account. Do you have the same result ? In case it would
work what if you make your ASP.NET application run under the same account ?
I'm not sure how .NET get these info (my understanding at least for 2.0
would be that they are build right into the framework ??). If the FW uses
system files to get those info then it could be a system level problem with
nls support files and I belive I saw once this in classic ASP and it was a
profile related issue...
--
Good luck, sorry for the poor help
> > On 30 Aug., 17:30, "Patrice" <http://www.chez.com/scribe/> wrote:
>
[quoted text clipped - 47 lines]
> I just tried setting CurrentUICulture to "da-DK", but with the same
> result..
I researched a little further:
If i insert the following code:
Response.Write("Language " + cultureInfo.Name + "<br />");
Response.Write("---------------------------------<br />");
Response.Write("CurrencySymbol " +
cultureInfo.NumberFormat.CurrencySymbol.ToString() + "<br />");
Response.Write("DateSeparator " +
cultureInfo.DateTimeFormat.DateSeparator + "<br />");
Response.Write("LongDatePattern " +
cultureInfo.DateTimeFormat.LongDatePattern.ToString() + "<br />");
Response.Write("ShortDatePattern " +
cultureInfo.DateTimeFormat.ShortDatePattern.ToString() + "<br />");
string[] days = cultureInfo.DateTimeFormat.DayNames;
for( int i = 0; i < days.Length; i++)
{
Response.Write(days[i] + "<br />");
}
Response.Write("---------------------------------<br />");
I get the following output:
Language da-DK
---------------------------------
CurrencySymbol $
DateSeparator /
LongDatePattern dddd, MMMM dd, yyyy
ShortDatePattern M/d/yyyy
søndag
mandag
tirsdag
onsdag
torsdag
fredag
lørdag
In other words: Some of the values are perfect danish (the days) while
others are stille american (datepattern, dateseperator and
currencySymbol)
I am puzzled:)
See if this sample code helps...
cultureChange.aspx:
-----------------------------
<%@ Page Language="VB" uiculture="auto" %>
<%@ Import Namespace="System.Threading" %>
<%@ Import Namespace="System.Globalization" %>
<script runat="server">
Protected Overrides Sub InitializeCulture()
If Request.Form("ListBox1") IsNot Nothing Then
Dim selectedLanguage As String = Request.Form("ListBox1")
UICulture = Request.Form("ListBox1")
Culture = Request.Form("ListBox1")
Thread.CurrentThread.CurrentCulture = CultureInfo.CreateSpecificCulture(selectedLanguage)
Thread.CurrentThread.CurrentUICulture = New CultureInfo(selectedLanguage)
End If
MyBase.InitializeCulture()
End Sub
Sub Page_Load(obj as object, e as eventargs)
Dim value as Double = 2.0
Dim s as String 'create a string and format it as currency.
s = String.Format("{0:c}", value)
lblMessage.Text = Listbox1.SelectedItem.Text
lblMessage2.Text = Listbox1.SelectedItem.Value & " " & DateTime.Now & " " & s
End Sub
</script>
<html>
<body>
<form id="form1" runat="server">
<div>
<asp:ListBox ID="ListBox1" runat="server">
<asp:ListItem Value="en-US" Selected="True">English</asp:ListItem>
<asp:ListItem Value="es-MX">Español</asp:ListItem>
<asp:ListItem Value="da-DK">Danish</asp:ListItem>
</asp:ListBox><br />
<asp:Button ID="Button1" runat="server"
Text="Set Language/Culture"
meta:resourcekey="Button1" />
<br />
<asp:Label ID="Label1" runat="server"
Text=""
meta:resourcekey="Label1" />
</div>
<div>
<asp:Label id="lblMessage" runat="server"/></asp:Label> <br />
<asp:Label id="lblMessage2" runat="server"/></asp:Label> <br />
</div>
</form>
</body>
</html>
----------
That code changes the culture/language on demand...
If you select Danish and click the Button, you'll see kr displayed, and the Danish time format,
but if you select English, you'll see $ displayed and the US time format.
You should be able to adapt it for your purposes.
Juan T. Llibre, asp.net MVP
asp.net faq : http://asp.net.do/faq/
foros de asp.net, en español : http://asp.net.do/foros/
======================================
> On 30 Aug., 17:30, "Patrice" <http://www.chez.com/scribe/> wrote:
>
[quoted text clipped - 41 lines]
> That displays en-US, but as far as i know, that does not affect
> formatting?
I just tried setting CurrentUICulture to "da-DK", but with the same
result..
Basildk - 30 Aug 2007 17:33 GMT
> See if this sample code helps...
>
[quoted text clipped - 110 lines]
> I just tried setting CurrentUICulture to "da-DK", but with the same
> result..
Thanks for the reply. I tried you code, but with the feared result:
Danish
da-DK 8/30/2007 6:32:32 PM $2.00
Juan T. Llibre - 30 Aug 2007 17:53 GMT
re:
!> Thanks for the reply. I tried you code, but with the feared result:
I don't have a clue why it would work at my server and not on yours.
See the online sample at :
http://asp.net.do/test/culture3.aspx
Are you formatting the string as currency, per the sample ?
!> Dim value as Double = 2.0
!> Dim s as String 'create a string and format it as currency.
!> s = String.Format("{0:c}", value)
If you don't format the string as currency, no currency symbol change can occur.
Juan T. Llibre, asp.net MVP
asp.net faq : http://asp.net.do/faq/
foros de asp.net, en español : http://asp.net.do/foros/
======================================
On 30 Aug., 18:21, "Juan T. Llibre" <nomailrepl...@nowhere.com> wrote:
> See if this sample code helps...
>
[quoted text clipped - 114 lines]
> I just tried setting CurrentUICulture to "da-DK", but with the same
> result..
Thanks for the reply. I tried you code, but with the feared result:
Danish
da-DK 8/30/2007 6:32:32 PM $2.00