Problem with language. Thank You.

  • Thread starter Thread starter Miguel Dias Moura
  • Start date Start date
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
 
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
 
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
 
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
 
Back
Top