Search code examples
urlodooodoo-14

How to change and/or remove links on translations [Odoo 14]


I developed my company website with Odoo (14) and it is multilingual. I am able to add/edit translations for texts but it seems that there is no way to edit links that I already gave to default langue pages.

For some contents, I need to change the link in different languages. For example, I am listing some documents to download and I want to change their links in other languages because the documents are different but, there is no option to edit links.

Or, for some cases, I only need to use the link on default page but not for translations. In this case, I cannot remove the link for translations.

Do you have any idea/solution about that?


Solution

  • The solution is that you can define which part of your code will be displayed in specific language that you have in your website. For instance, if it is in English and French you can define something like below.

    <t t-if="'en' in request.env.lang">
        <a class="btn" href="yourlink/en">DOWNLOAD</a>
    </t>
    
    <t t-if="'fr' in request.env.lang">
        <a class="btn" href="yourlink/fr">TÉLÉCHARGER</a>
    </t>