Bỏ qua để đến Nội dung
Menu
Câu hỏi này đã bị gắn cờ

Website translation mode allows translating only texts. Is it possible to show different images/blocks for different languages as well?

For example, the page is the same for various languages, the only difference is in one image. Especially it is required in case of posting screenshots for service description or for user mannuals.

Ảnh đại diện
Huỷ bỏ
Tác giả Câu trả lời hay nhất

A little investigation leads to the method:

1. Basically, we may learn current language by using request.lang

2. We may show / not show the element bu using t-if

Such approach allow making different structure for various languages. For example, to show different types of question marks for en_US and de_DE languages:

<div class="mt16 col-md-5" t-if="request.lang == 'en_US'"> 
    <span style="color:#FF0000;">
        <span class="mb16 fa fa-question-circle fa-5x" src="" style="animation-play-state: paused; transition: none"/>
    </span>
</div>
<div class="mt16 col-md-5" t-if="request.lang == 'de_DE'">
    <span style="color:#FF0000;">
        <span class="mb16 fa fa-question fa-5x" src="" style="animation-play-state: paused; transition: none"/>
    </span>
</div>

It is important, that no controller rewriting is required, only xml change.

A problem is that element in not default language may be changed only via HTML editor, since Website editor is for default language.

Ảnh đại diện
Huỷ bỏ
Câu trả lời hay nhất

With odoo v13:


<div class="mt16" t-if="request.env.lang == 'en_US'"> 
    // EN Content
</div>
<div class="mt16" t-if="request.env.lang == 'es_MX'">
    // ES content
</div>
Ảnh đại diện
Huỷ bỏ
Câu trả lời hay nhất

Check this: https://apps.openerp.com/apps/modules/8.0/website_banner_multilang/

Ảnh đại diện
Huỷ bỏ
Tác giả

The app seems appropriate. Thank you. However, it doesn't cover all cases. Do you know the principles which are in base of the module? Some xml attributrs, controller functions?

If you download the app, you can check the code and see. This app only offers a mulitlingual banner building block, but you can develop the same for other building blocks.

Bài viết liên quan Trả lời Lượt xem Hoạt động
Website translation Đã xử lý
2
thg 3 15
5458
1
thg 3 15
7756
2
thg 3 22
7470
1
thg 6 15
3480
1
thg 3 21
11168