根据Drupal 7中的语言切换伴奏(Switching the Style depending on the language in Drupal 7)

编程入门 行业动态 更新时间:2024-10-27 20:39:12
根据Drupal 7中的语言切换伴奏(Switching the Style depending on the language in Drupal 7)

我想改变风格取决于语言。 例如,当我将网站语言切换为阿拉伯语时,我希望我编写的rtl样式生效,并在切换回英语时取消设置rtl样式。 如何在Drupal 7中实现这一目标? 我试过这个答案,但对我不起作用。

I want to change the style depends on the language. For example, when I switch the site language to Arabic I want the rtl style that I wrote to take effect and to unset the rtl style when switching back to English. How to achieve that in Drupal 7? I tried this answer but didn't work for me.

最满意答案

最简单的方法是使用语言类Drupal添加到body元素。 检查你的页面html,看看body标签有哪些类。 应该有一些类似于“i18n-de”的类(在这种情况下是德语)。 然后你可以使用它来设置body标签内的任何元素(基本上所有元素),如:

body.i18n-de div#header {.some css.} body.i18n-en div#header {.some other css.}

The simplest way is to use language class Drupal is adding to body element. Check your page html and see what classes body tag has. There should be some class similar to "i18n-de" (in this case for German). Then you can use it to style differently any element inside body tag (basically all of them), like:

body.i18n-de div#header {.some css.} body.i18n-en div#header {.some other css.}

更多推荐

本文发布于:2023-08-06 05:42:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1445049.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:语言   Switching   Drupal   language   depending

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!