Zend Framework - 我如何从右到左翻译和切换语言

发布于 2024-10-10 06:57:42 字数 1524 浏览 2 评论 0原文

我怎样才能规范我的从右到左的语言,它是阿拉伯语。所以必须从右到左开始,包括所有的滚动条、输入框,上传整个布局实际上要求从右到左显示。

这是我的布局:

<?= $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 DIR

  • http://www.w3.org/TR/REC-html40/struct/dirlang.html
    This is a solution actually

  • It 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

貪欢 2024-10-17 06:57:42

我的大部分网站都使用阿拉伯语,我不必一直依赖 dir="RTL"
例如 :
在我处理的每个项目中,

  1. 我使用 960 grid + jQuery + ZF
  2. 我用来浮动大部分元素
    右侧为 div 、 p 、 table
    , em , h1 ... h6 , 表单输入

    有时我为 p 标签添加样式
    像这样: direction:RTL 来制作
    事物正确对齐
  3. 我习惯于为任何设置图表集
    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 time
for example :
on every project i work with ,

  1. i use 960 grid + jQuery + ZF
  2. I used to float most of my element
    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 make
    thing align correctly
  3. I am used to set chartset for any
    part of the application to UTF8 form the view to the database ... etc

hopefully 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 flipped

but 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' attribute

what i meant to say : control your element on the page

海拔太高太耀眼 2024-10-17 06:57:42

我不确定这是最好的方法,但我首先将应用程序范围的区域设置设置为相应的语言/区域(例如 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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文