PHP 前端多语言
我需要支持大约 20 种语言(有些是从右到左)。数据库一切都很好,我们已经正确完成了,但probem是从右到左的语言的前端。我的开发团队给了我以下选项的组合:
1) 为从右到左和从左到右创建单独的 php 视图文件
2)为从右到左和从左到右创建单独的CSS样式
但是我不高兴;我只想使用 1 个视图和 CSS 样式集并能够控制它们。显然,我需要更改文本方向,还需要更改 UI 元素方向,因此翻转所有页面内容/对象的页面。如何才能实现这一目标?
我正在阅读两个 CSS 属性:direction 和 unicode-bidi。 两者可以单独实现文本方向和 UI 翻转的需求吗?还是我绝对必须使用他们的选项或其他方式?
应该没有什么区别,但我们将 codeignitor 与 hbase 和 mysql 一起使用。
I need to support about 20 languages (some are right to left). The database is all fine and we have that done properly but probem is the front end for the languages that are right to left. My dev team gave me a combo of these options:
1) Create seperate php view files for right to left and left to right
2) Create seperate CSS styles for right to left and left to right
But i am not happy; I want to use only 1 view and CSS style set and be able to control these. Obiviously i need to change the text direction and also need to change the UI elements direction so flip the page for all page content/objects. How can this be achieved?
I was reading on the two CSS properties: direction and unicode-bidi.
Can the two alone achieve both needs of text direction and UI flip or do i absolutely have to use their option or some other way?
Shoudn't make a diffrence but we are using codeignitor with hbase and mysql.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
有点取决于你如何构建页面,我不太熟悉阿拉伯语布局,但这里有一些想法:
如果你制作了正确的 html 结构,你应该能够仅使用一些 css 属性来翻转页面。为了不必维护重复的 css 文档,我建议您向 body 标记添加一个类,指示它是从右到左的设计,并且当该类存在时,将应用新的样式规则来调整页面从右到左方向布局。
做了一个小例子: http://jsfiddle.net/PVhfR/ (使用 id 为 #body 的 div样本中的真实身体元素)
Depends a bit on how you have built the page, I am not that familiar with arabic layouts but here are some thoughts:
If you have made a proper html structure you should be able to flip the page with just a few css properties. In order to not having to maintain duplicate css documents I would recommend that you add a class to the body tag that indicates that it is a right to left design, and when that class is present new style rules are applied that adjust the page for a right to left direction layout.
Made a small example: http://jsfiddle.net/PVhfR/ (uses a div with id #body instead of a real body element in the sample)
对于结构,您应该使用
float: left
和float: right
以及边距来塑造它;这样做,当您反转从右到左 CSS 中的方向时,整个布局应该翻转。direction: rtl
应该用于书写区域,就像所有输入元素一样,以翻转书写方向。For the structure, you should shape it using
float: left
andfloat: right
and margins; doing this, when you invert the directions in the right-to-left-CSS, the whole layout should flip.direction: rtl
should be used for writing areas, like all the input elements, to flip the writing direction.