Get Help:Ask a Question in our Forums|Report a Bug|More Help Resources
Last post Jun 21, 2010 07:16 PM by letter2sanjay1
Jul 03, 2006 10:10 AM|LINK
lang = Request.Form(cookie.Value)
Thread.CurrentThread.CurrentUICulture = CultureInfo.GetCultureInfo(lang)
Thread.CurrentThread.CurrentCulture = CultureInfo.CreateSpecificCulture(lang)
cookie.Value = Language1.UniqueID
Thread.CurrentThread.CurrentUICulture = CultureInfo.CurrentCulture
Jul 10, 2006 02:45 PM|LINK
What happen if cookie is not enabled on the client browser? any other solutions?
Jul 12, 2006 07:46 AM|LINK
I figured out a solution for the problem in the thread, its a combination of all posts including this one
it’s not that clean but I think it’s better than nothing and I like to share the idea with you as you are more experienced, I’m going to tell you the situation how I solved that.
1-Build a multilingual website using ASP.NET 2.0 for my company
2-MaterPage with a change language combo that is localized at the first request of the page [suing asp.net 2.0 new browser request culture detection] and then the user can change the language any time from the master page. [So the new culture reflects all the
3-It’s supposed that there are 3 languages, English, French and Arabic [Arabic needs the pages to rendered in RTL
L I did it but there is some issues]
I didn’t put any code in the global.asax -
Application_BeginRequest, I figured out a way for doing that, thanks for the great hint of
to use the helper class which actually is a class that inherits from a webpage to add the
InitializeCulture() , and then make all site pages inhereit from this baseclass.
What I did:
a. Add the global resource files under the App_GlobalResources folder:
b. HTML direction attribute to be retrieved from a global resource to adjust page direction [in case of English, French it will be LTR and Arabic will be RTL
dir='<%$ Resources:AllSite, TextDirection
c. localized label and combo for language selection
Text="Select your language:"></asp:Label>
Code: to handle the language (culture selection) and then return the referrer page
void comboSelLanguage_SelectedIndexChanged(object sender,
// this is for the redirecting to the referrer page
3-Build a BaseClass under the App_Code\BL forlder in your project ,that all pages will inherit from.
/// Summary description for BasePage
class BasePage :Page
// TODO: Add constructor logic here
override void InitializeCulture()
= string.Empty;//default to the invariant culture
&& cookie.Value !=
4-Build the web pages [the will be in the content place holder in the master page] and generate local resources, and DON’T FORGET INHERIT FROM THE BASEPAGE CLASS ;), and add your local resources
My Issues is that some controls doesn’t render to RTL well , I don’t know why and what’s going to drive me nuts is the same control (ex: asp:Label) renders sometimes right and sometimes wrong
.. I think there is a web design consideration that should be taken or layout considerations to support both RTL and LTR languages; I hope any one can help me in this area
Hope this helps
Jul 18, 2006 08:20 AM|LINK
first I want to say that I prefer the global.asax solution - it's much easier for locaolize an homepage which already exists. also microsoft means that editing the global.asax is a goot way to make changes for a whole website.
but it doesn't matter, my problem is a little bit different
set the uiculture and co to auto and starting my browser with different language settings let everything work fine, especially the Convert.ToDateTime(Textbox1.Text); works fine.
But if I do a language switch with a drop down box like mentioned in the post - I get an exception when my code tries to convert the same textbox with the localized date.
so whats the main problem hier - letting the browser set the language everything looks the same on the frontend then setting the language by hand. only problem is - when I set the language by hand the convert.todatetime throws an exception.
Jul 31, 2006 09:55 AM|LINK
Hello, could you explain this step in detail please.
4-Build the web pages [the will be in the content place holder in the master page] and generate local resources, and
DON’T FORGET INHERIT FROM THE BASEPAGE CLASS ;), and add your local resources for them.
Jul 31, 2006 10:24 AM|LINK
well i've mentioned before that you should create a helper class, that all your webpages will inherit from to execute the code in the InitializeCulture() in all tour pages without having to override this mehtod in every webpage
"3-Build a BaseClass under the App_Code\ forlder in your project ,that all pages will inherit from :
// TODO: Add constructor logic here
string lang = string.Empty;//default to the invariant culture
HttpCookie cookie = Request.Cookies["SelLang"];
if (cookie != null && cookie.Value
lang = cookie.Value;
the bold text was just a hint not to forget :) to do that for very web page:
Dec 01, 2006 10:12 AM|LINK
Thak you for this forum, it has helped mi so much!!![:D] I've used
Mi code in the Master Page is:
Mi code in the class BasePage is like this:
string lang= (string)ViewState["Idiom"];
And then the code is the same as
EngMotagaly, but it doesn't work and i don't know if i need to enable viewState somewhere (i'm beginning whit asp.net). Any ideas?
Than you so much and sorry for my english (i'm spanish)
Dec 14, 2006 05:02 PM|LINK
I use your code to apply my page. But there is an error
"Value cannot be null.
Parameter name: name"
Error occurs at line
I don't know why. Can you show me how...Thanks very much
Dec 14, 2006 05:20 PM|LINK
Dec 20, 2006 10:52 AM|LINK