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

Hello,

Do you know how to translate a link?

I've a link named "see products" to "/products" of my webshop.

In French, the webshop will automatically translate "/products" to "/produits". But my link "see products" that I translate to "voir produits" will still redirect to "/products".

So how can I change also translate a link, so "voir produits" redirect to "/produits"?

Thanks,

Thomas.

Imagine profil
Abandonează
Cel mai bun răspuns

Hi Thomas,

Odoo built-in mechanism is a little different from your approach.

In website interface, an user has a chance to select his/her prefer language. It  is at the bottom-right corner of website page.

If a user selects 'Français', he/she will be redirected to yoursite.com/fr_FR/products and sees content in French. These content will be translated by you.

Your job now is to login as administrator/website user with 'Editor and Designer' permission, switch to French and translate content of your pages.

Imagine profil
Abandonează
Cel mai bun răspuns

  We are facing a similar problem. We try to link to PDF documents, youtube videos or 3rd-party sites in four different languages. This issue makes the translation module and consequently the whole website builder useless for us. Has anyone solved this?  

Imagine profil
Abandonează

Hi!
Same here @michal! My website is multilingual and i have some pdf links for default language page (EN) and for other languages, i cannot edit the link. It is so annoying!

Autor Cel mai bun răspuns

Hello,
I don't explain my self well.
I'm doing redirecting from my odoo website to the e-commerce.
In English, in the website, the user will have a "see products" button with a redirection to "/EN/theproduct.
In French, I'd like to have a "voir produit" button with a redirection to /FR/leproduit.
Do you understand?
Thanks !

Imagine profil
Abandonează
Cel mai bun răspuns

@michael
@george

I think the only way to do this (Odoo 15) is via code or by changing the view architecture, for example ...

id="footer_custom" inherit_id="website.footer_custom">
expr="//ul[hasclass('list-unstyled')]" position="inside">


t-if="request.context.get('lang') == 'en_US'">
href="https://www.odoo.com/documentation/15.0/applications/websites/website.html" target="_blank">Documentation

t-if="request.context.get('lang') == 'nl_BE'">
href="https://www.odoo.com/documentation/15.0/nl/applications/websites/website.html" target="_blank">Documentatie








Imagine profil
Abandonează

To translate href attributes in QWEB, you could also use t-set. This way the strings are added to the translation files as well and there is no need to work with if statements for each language.

For example:
QWEB:
<u>
<t t-set="my_url_to_translate">https://support.mywebsite.com/en-us</t>
<a t-att-href="my_url_to_translate">Contact us</a>
</u>

Translation nl.po file:
#. module: module_name
#: model_terms:ir.ui.view,arch_db:module_name.template_name
msgid "https://support.mywebsite.com/en-us"
msgstr "https://support.mywebsite.com/nl"