Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Change text direction for all pages

I am working on a web project that can be in multi langauges, i have done all of that, i still have one thing.

the pages when shows in english is from left to right.

some languages on my website needs to be from right to left

Note please, my question is about the whole page not the text in fields.

how can i do that please?

I am using this code for launching threads for many languages.

Thread.CurrentThread.CurrentCulture = new CultureInfo(CultureName);
Thread.CurrentThread.CurrentUICulture = Thread.CurrentThread.CurrentCulture;

I don't know what i think that the previous code could be helpful in order to achieve my goal.

like image 447
user2208349 Avatar asked Nov 11 '13 17:11

user2208349


2 Answers

bool Thread.CurrentThread.CurrentCulture.TextInfo.IsRightToLeft

See as example: http://afana.me/category/Website-Optimization.aspx?page=2

To flip the whole page use either HTML tag attributes

<body dir="rtl" align="right">

or CSS properties on body tag

direction:rtl; text-align:right;

Direction is to control BiDi for the language script. Align is used to control visual display alignment.

like image 113
user.dz Avatar answered Sep 19 '22 10:09

user.dz


You can use this code in _Layout to Change text direction for all pages: in body tag

<body dir="@(System.Threading.Thread.CurrentThread.CurrentCulture.TextInfo.IsRightToLeft? "rtl" : "ltr")">

like image 21
Aladein Avatar answered Sep 18 '22 10:09

Aladein