odooodoo-8openerp-8odoo-website

Odoo8: How to translate website content added by the user from backend


I have made a custom module for odoo 8 that adds a photogallery on the website. The user can then add images and descriptions from the backend that will be automatically displayed in the frontend.

Is there a way to translate texts efficiently in odoo that is added "dynamically" by the user such as image descriptions or product descriptions? My idea is that the visitor can change language in the frontend and the correct translation should then be displayed next to the image.

Or do I need to have a description field in the backend for each language that I want support for?

EDIT: The gallery is implementedd like this at the moment

    <t t-foreach="photos" t-as="photo">
        <table style="width:90%" align="center">
        <tr>
            <td style="width:60%;"> <span t-field="photo.image" t-field-options='{"widget": "image"}' /> </td>
            <td style="width:40%; vertical-align:top;" >
                <font size="4" face="Comic Sans MS">
                <u><t t-esc="photo.name"/></u><br></br>  
                <t t-esc="photo.description" /> 
                </font>
            </td>
        </tr>
        </table>
    </t>

Is there a way to translate the content of the photo.description field and not just only the name?


Solution

  • It should be enough to make the description fields translatable in the backend. Just add translate=True to the field definitions. I don't know how you've added the gallery, but if it was done correctly, multi language support should work with users that are logged in! All other website users (without login) should see the website in default language.