Problem with language. Thank You.

M

Miguel Dias Moura

Hello,

i have a Calendar Control in my web site and when it's in my computer the
months and weekdays are in portuguese.
When i change it to my server the months and weekdays change to english.

Do you think i can solve this by changing culture in my web.config file?

If yes, can you tell me what should be the code to include in the web.config
file to force my culture to portuguese?

If no, can you tell me what should be the solution?

Thank You,
Miguel
 
K

Ken Cox [Microsoft MVP]

Hello Miguel,

One solution would be to put your culture information in the web.config like
this:

<configuration>
<appSettings>
<add key="CI" value="pt-PT" />
</appSettings>

<system.web>
.....

Then, you could retrieve the value in a variable and use the CultureInfo
class to set the language of the calendar:


Public strCI As String
Private Sub Page_Load _
(ByVal sender As System.Object, _
ByVal e As System.EventArgs) _
Handles MyBase.Load
strCI = ConfigurationSettings.AppSettings("CI")
If Not IsPostBack Then
Dim dtNow As Date = DateTime.Now
Dim strName As String = Session("strLanguage")
Thread.CurrentThread.CurrentUICulture = _
New CultureInfo(strCI, False)
Thread.CurrentThread.CurrentCulture = _
New CultureInfo(strCI)
Calendar1.SelectedDate = dtNow
Calendar1.VisibleDate = dtNow
End If
End Sub


Private Sub Calendar1_SelectionChanged _
(ByVal sender As System.Object, _
ByVal e As System.EventArgs) _
Handles Calendar1.SelectionChanged
Thread.CurrentThread.CurrentUICulture = _
New CultureInfo(strCI, False)
Thread.CurrentThread.CurrentCulture = _
New CultureInfo(strCI)
End Sub


Does this help?

Ken
Microsoft MVP [ASP.NET]
Toronto
 
M

Miguel Dias Moura

Hi,

i am getting some problems in making this code work. Could you please send
me an example page with a calendar control and how to use the code you
sugested me?

Please use my email (e-mail address removed)

Thank You Very Much,
Miguel

Ken Cox said:
Hello Miguel,

One solution would be to put your culture information in the web.config like
this:

<configuration>
<appSettings>
<add key="CI" value="pt-PT" />
</appSettings>

<system.web>
....

Then, you could retrieve the value in a variable and use the CultureInfo
class to set the language of the calendar:


Public strCI As String
Private Sub Page_Load _
(ByVal sender As System.Object, _
ByVal e As System.EventArgs) _
Handles MyBase.Load
strCI = ConfigurationSettings.AppSettings("CI")
If Not IsPostBack Then
Dim dtNow As Date = DateTime.Now
Dim strName As String = Session("strLanguage")
Thread.CurrentThread.CurrentUICulture = _
New CultureInfo(strCI, False)
Thread.CurrentThread.CurrentCulture = _
New CultureInfo(strCI)
Calendar1.SelectedDate = dtNow
Calendar1.VisibleDate = dtNow
End If
End Sub


Private Sub Calendar1_SelectionChanged _
(ByVal sender As System.Object, _
ByVal e As System.EventArgs) _
Handles Calendar1.SelectionChanged
Thread.CurrentThread.CurrentUICulture = _
New CultureInfo(strCI, False)
Thread.CurrentThread.CurrentCulture = _
New CultureInfo(strCI)
End Sub


Does this help?

Ken
Microsoft MVP [ASP.NET]
Toronto

Miguel Dias Moura said:
Hello,

i have a Calendar Control in my web site and when it's in my computer the
months and weekdays are in portuguese.
When i change it to my server the months and weekdays change to english.

Do you think i can solve this by changing culture in my web.config file?

If yes, can you tell me what should be the code to include in the
web.config
file to force my culture to portuguese?

If no, can you tell me what should be the solution?

Thank You,
Miguel
 
M

Miguel Dias Moura

No need,

i just solved it.

Thank You Anyway,
Miguel

Miguel Dias Moura said:
Hi,

i am getting some problems in making this code work. Could you please send
me an example page with a calendar control and how to use the code you
sugested me?

Please use my email (e-mail address removed)

Thank You Very Much,
Miguel

Ken Cox said:
Hello Miguel,

One solution would be to put your culture information in the web.config like
this:

<configuration>
<appSettings>
<add key="CI" value="pt-PT" />
</appSettings>

<system.web>
....

Then, you could retrieve the value in a variable and use the CultureInfo
class to set the language of the calendar:


Public strCI As String
Private Sub Page_Load _
(ByVal sender As System.Object, _
ByVal e As System.EventArgs) _
Handles MyBase.Load
strCI = ConfigurationSettings.AppSettings("CI")
If Not IsPostBack Then
Dim dtNow As Date = DateTime.Now
Dim strName As String = Session("strLanguage")
Thread.CurrentThread.CurrentUICulture = _
New CultureInfo(strCI, False)
Thread.CurrentThread.CurrentCulture = _
New CultureInfo(strCI)
Calendar1.SelectedDate = dtNow
Calendar1.VisibleDate = dtNow
End If
End Sub


Private Sub Calendar1_SelectionChanged _
(ByVal sender As System.Object, _
ByVal e As System.EventArgs) _
Handles Calendar1.SelectionChanged
Thread.CurrentThread.CurrentUICulture = _
New CultureInfo(strCI, False)
Thread.CurrentThread.CurrentCulture = _
New CultureInfo(strCI)
End Sub


Does this help?

Ken
Microsoft MVP [ASP.NET]
Toronto

Miguel Dias Moura said:
Hello,

i have a Calendar Control in my web site and when it's in my computer the
months and weekdays are in portuguese.
When i change it to my server the months and weekdays change to english.

Do you think i can solve this by changing culture in my web.config file?

If yes, can you tell me what should be the code to include in the
web.config
file to force my culture to portuguese?

If no, can you tell me what should be the solution?

Thank You,
Miguel
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,754
Messages
2,569,522
Members
44,995
Latest member
PinupduzSap

Latest Threads

Top