Zend Framework - 我如何从右到左翻译和切换语言
我怎样才能规范我的从右到左的语言,它是阿拉伯语。所以必须从右到左开始,包括所有的滚动条、输入框,上传整个布局实际上要求从右到左显示。
这是我的布局:
<?= $this->doctype();// xhtml = strict ?>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<?php echo $this->headTitle(); ?>
<?php echo $this->headMeta(); ?>
<?php echo $this->headScript(); ?>
<?php echo $this->headLink()->prependStylesheet('/css/production.css'); ?>
<link rel="shortcut icon" href="/img/pageicon.png" type="image/x-icon" />
<link rel="alternate" type="application/rss+xml" title="We care Arab Page" href="/rss.xml" />
</head>
<body>
!!!!!! everything need right to left, where default page is english (left to right).!!!!!
</body>
</html>
请指教? :)
谢谢&问候
后续:
$this->view->headMeta()->appendName('Language','en');
这与 DIR 无关- 。 org/TR/REC-html40/struct/dirlang.html 这实际上是一个解决方案
它有效
< html xmlns="http://www.w3.org/1999/xhtml" lang="ar" dir="RTL" >
ZF->如何从 MVC 控制器分配它?
< html xmlns="http://www.w3.org/1999/xhtml" lang="ar" dir=< ?= $this->rtl; ? > > ???
尝试了 2 个建议
<身体风格=“方向:rtl;” > 或者 < html xmlns="http://www.w3.org/1999/xhtml" lang="ar" dir="RTL" >
没有看到任何方向改变的差异。图像没有翻转,其余的都完全翻转。
How can i regularise my right to left language where it is Arabic language. So it must start from right to left including all scroll bar, input box, upload whole layout is actually required to be shown as right to left.
This is my layout:
<?= $this->doctype();// xhtml = strict ?>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<?php echo $this->headTitle(); ?>
<?php echo $this->headMeta(); ?>
<?php echo $this->headScript(); ?>
<?php echo $this->headLink()->prependStylesheet('/css/production.css'); ?>
<link rel="shortcut icon" href="/img/pageicon.png" type="image/x-icon" />
<link rel="alternate" type="application/rss+xml" title="We care Arab Page" href="/rss.xml" />
</head>
<body>
!!!!!! everything need right to left, where default page is english (left to right).!!!!!
</body>
</html>
Please advise ? :)
Thanks & Regards
Follow up:
$this->view->headMeta()->appendName('Language','en');
This is not related to DIRhttp://www.w3.org/TR/REC-html40/struct/dirlang.html
This is a solution actuallyIt works
< html xmlns="http://www.w3.org/1999/xhtml" lang="ar" dir="RTL" >
ZF-> How do you assign it from MVC controller ?
< html xmlns="http://www.w3.org/1999/xhtml" lang="ar" dir=< ?= $this->rtl; ? > > ???
tried 2 suggestion
< body style="direction:rtl;" >
OR
< html xmlns="http://www.w3.org/1999/xhtml" lang="ar" dir="RTL" >
Dont see any differences for direction changing. Image does not flip, all the rest flip exactly.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我的大部分网站都使用阿拉伯语,我不必一直依赖
dir="RTL"
例如 :
在我处理的每个项目中,
右侧为
div 、 p 、 table
, em , h1 ... h6 , 表单输入
有时我为 p 标签添加样式
像这样:
direction:RTL
来制作事物正确对齐
UTF8
应用程序的一部分形成数据库的视图......等等希望我没有错过任何东西
祝你好运
更新
让我们以facebook.com 阿拉伯语页面为例,它没有有像你这样的代码
< html xmlns="http://www.w3.org/1999/xhtml" lang="ar" dir="RTL" >
,正文标记的样式为
direction:RTL
您会看到一些表单元素翻转但请注意世界图像,它没有向左翻转,但在您的情况下,如果删除此
dir=',所有元素都会翻转rtl'
属性我的意思是:控制页面上的元素
I do most of my web sites in arabic language and i don't have to depend in
dir="RTL"
all the timefor example :
on every project i work with ,
to the right for
div , p , table
, em , h1 ... h6 , form input
and some times i add style for p tag
like this :
directtion:RTL
to makething align correctly
part of the application to
UTF8
form the view to the database ... etchopefully i didn't miss any thing
and Good luck
update
let's take the facebook.com arabic page as an example , it doesn't have code like yours
< html xmlns="http://www.w3.org/1999/xhtml" lang="ar" dir="RTL" >
,the body tage has style for
direction:RTL
you would see some of the form elements flippedbut notice the world image , it didn't flip to the left but in your case all the element would flip if you removed this
dir='rtl'
attributewhat i meant to say : control your element on the page
我不确定这是最好的方法,但我首先将应用程序范围的区域设置设置为相应的语言/区域(例如 en_US 或任何其他适合您需要的)。然后,我将提供相应的翻译文件以适合所有可用语言,然后设置新的 css 以反映从右到左的阅读方向并重新组织页面布局。
即使您设置了其他语言,这些更改也不会在浏览器中神奇地发生。只有字符集会适应您的区域设置。
I'm not sure it's the best way to do it, but i would first set an application wide locale to the corresponding language/region (like en_US or any other that suits your needs). I would then provide the corresponding translation files to fit all the availables languages and then set a new css to reflect the right-to-left reading direction and reorganize the page layout.
The changes won't occur magically in the browser, even if you set an other language. Only the charset will adapt to your locale.