Hello Experts,
we are trying to have our existing aSP.net website into Spanish also.
For this I created a class Language which inherits System.Web.UI.Page. (Because all the content pages are inhereited from
System.Web.UI.Page
So I created Language class inherits System.web.UI.Page and then changed my content page inherits Language class)
My Language Class has following code
Public Class Language
Inherits System.Web.UI.Page
Protected Overrides Sub InitializeCulture()
Dim cookie As HttpCookie = Request.Cookies("Lang")
Dim lang As String = String.Empty
If cookie IsNot Nothing AndAlso cookie.Value IsNot Nothing Then
lang = cookie.Value
End If
If Not lang.Contains("Select") Then
Dim culLan As CultureInfo = CultureInfo.CreateSpecificCulture(lang)
Thread.CurrentThread.CurrentUICulture = culLan
Thread.CurrentThread.CurrentCulture = culLan
End If
MyBase.InitializeCulture()
End Sub
End Class
One of the Content page is like below
Partial Class Products
Inherits Language
Now My variable lang in Language class has value es-MX - Spanish and there are no errors while debugging this. However my ASPX page is not changing from English to Spanish .
Could anyone please help me ?
This has to do langue switch dynamic only. I don't have static single html/aspx pages . So please correct me where is the mistake in this?
What I have tried:
So far I have first with google translator and then the code shown above. I cannot do with resource files because my website is really huge and Its hard to resource value for each string and all the products or items have different descriptions that comes from DB.
I am not sure if i am missing any step in between these ...