跳至內容
選單
此問題已被標幟
4 回覆
4163 瀏覽次數

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.

頭像
捨棄
最佳答案

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.

頭像
捨棄
最佳答案

  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?  

頭像
捨棄

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!

作者 最佳答案

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 !

頭像
捨棄
最佳答案

@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








頭像
捨棄

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"