Click here to Skip to main content
15,921,454 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Dear All,

I have build multilingual website in asp.net c#.

But, its not changing the page direction when changing cultureInfo. I have two languages "en-US" and "ar-SA".

When cultureinfo changes, the text is getting change from English to Arabic, but, not changing the page direction from left to right.

What I have tried:

#region Language/Culture

		string cultureKey = Request.QueryString["l"];
		CultureInfo ci = CultureHelper.GetCulture(cultureKey);
		if (ci == null)
		{
			cultureKey = CultureHelper.DefaultCultureKey;
			ci = CultureHelper.DefaultCulture;
		}

		if(ci != null)
			CookieHelper.SetLanguagePreference(Context, cultureKey);

		#endregion

		string returnUrl = Request.QueryString["ru"];
		if (string.IsNullOrEmpty(returnUrl))
			returnUrl = PageLink.HomePage;

		Response.Redirect(returnUrl);



Can anyone please help me.


Thanks in advance.
Posted
Updated 7-Feb-18 3:09am

1 solution

You need to change all these places (or at least most of them, this is something that works for me)
C#
protected override void InitializeCulture()

{

if (Request.Form["culture"] != null)

{

String selectedLanguage = Request.Form["culture"];

UICulture = selectedLanguage;

Culture = selectedLanguage;

Thread.CurrentThread.CurrentCulture =

CultureInfo.CreateSpecificCulture(selectedLanguage);

Thread.CurrentThread.CurrentUICulture = new

CultureInfo(selectedLanguage);

}

base.InitializeCulture();

}
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900