I have a website written in core php , I want to add Arabic language . So i have to make LTR to RTL dynamically . But how can I do it ? do i have to change all css code and rewrtie them all for RTL or is there anythins else ? I searched a lot and found rtlcss but how can i implement them easily ?
all of the following code is pure examples and will be shortened
index.html
<html>
<head>
<link rel="stylesheet" type="text/css" href="/css/main.min.css">
<!-- this should be included if the user's language is RTL -->
<link rel="stylesheet" type="text/css" href="/css/rtl.min.css">
</head>
<body></body>
</html>
/* here goes all css codes that goes with all pages */
body {
padding-top: 50px;
}
div.tab-content {
padding-top: 20px;
}
.main-panel {
float: right;
}
/* this will override the previous css rule */
.main-panel {
float: left;
}
body {
direction: rtl;
margin: 0;
}
you can also join them together in one file and in your php file add class to body .rtl
and in your css file ( of course at the end ) add css rules like:
body.rtl {
direction: rtl;
}
but for sake of lighter css files and since many users will not benefit from the RTL rules i would advise using the first example
there is some online converter to transform ltr based css code to rtl based css code . Then i added different css for different choice of user . SO there will be two css file .