我正在设计一个多语言网站,它支持 ltr
和 rtl
两种文本方向。
Language:
I stored languages in arrays like this
$lan=array('browse'=>'تصفح','add'=>'إضافة','signin'=>'تسجيل دخول');
and saved them in separate php files and Iinclude
the selected language. I use it within the HTML codes like<?php echo $lan['browse'];?>
direction:
Most of direction issues can be solved by the CSS property
dir
. However, sometimes you need to specify different properties for different directions. Therefore, I gave the body a class name which is either "rtl" or "ltr" and then I use it as the following:.brs_search_box{ display: inline-block; width: 199px; border: 1px solid #d3d3d3; height: 500px; } .rtl .brs_search_box{ border-left: 0; } .ltr .brs_search_box{ border-right: 0; }
这种技术有什么缺点吗?例如,大型数组会产生不良影响吗?
.brs_search_box[dir="ltr"] { something }
和.brs_search_box[dir="rtl"] { something else }
。 - Voitcus