Skip to Content
Meniu
Trebuie să fiți înregistrat pentru a interacționa cu comunitatea.
Această întrebare a fost marcată
3 Răspunsuri
2679 Vizualizări

Hi folks,

We're working with odoo 8.1 and one task is to build a website, which is nearly done.


The problem: our website is bilingual  and we have a banner slider - is it possible to change the images of the banner slider as soon as the user clicks on the language-toggle?


How much effort does this take - to me a possible solutions might be a JavaScript DOM manipulation.  Am I right?

Thanks in advance!

Imagine profil
Abandonează

Thanks Ermin Trevisan! One question: Will this module work with odoo V. 8.1?

There is no such thing as Odoo 8.1. It is working for your Odoo version.

Cel mai bun răspuns

You can also drop 2 sliders, and add with the html editor a t-if lang='lang1' and t-if lang='lang2' to choose which one is shown to the end user.

 

Imagine profil
Abandonează
Cel mai bun răspuns

You can do this by adding javascript by adding a <code> block where you want to add a multilangual change.

<!-- your HTML image -->
<img id="taal-img" src="https://your.website.url/image.png" alt="alt text" style="width:100%;" loading="lazy">

<script>
  (function() {
    const path = window.location.pathname;
    const img = document.getElementById("taal-img");

    if (!img) return; // If image does not exist, stop
//
    if (path.startsWith("/en/")) {
      img.src = "https://your.website.url/image_en.png";
    } else if (path.startsWith("/fr_FR/")) {
      img.src = "https://your.website.url/image_fr.png";
    } else {
      img.src = "https://your.website.url/image.png";
    }
  })();
</script>

path.startsWith is the place where you set your language.
You can see this value when you go to your website and change to another language.

If there is no value the standard image will be shown (standard language of website)

Hope this helps

Imagine profil
Abandonează
Cel mai bun răspuns

You may check this module: https://apps.openerp.com/apps/modules/8.0/website_banner_multilang/

Imagine profil
Abandonează