Skip to Content
Menu
This question has been flagged
3 Replies
8960 Views

I want to translate from english to other language example VietNam

msgalert = {'title':'Tittle','message':'text'}

val = {}

        return {'value': val,'warning':msgalert}

When i show pop-up, I want my warning is:

'title':'Tiêu đề'; 'message':'Thông tin cảnh báo'

Someone could help me?

Avatar
Discard
Best Answer

Hi,

from openerp.tools.translate import _

val = {}
warning = {'title': _('Your Title!'),
            'message': _('Your Message')
           }
 return {'value': val,'warning':msgalert}

install your module and export translate file menu Settings>>Export translation.

the steps Complete : Here

Thanks.

Avatar
Discard
Best Answer

Hello Everyone,

I also faced the same issue with odoo v12 enterprise, with python message there was trouble in translation.

Here what is did that has solved my problem:

Explaining with sample message that i will translate in Spanish.


Note : I'm considering you have already exported .po file for your language.

Consider module name is : anil_test_translate

and .py file name : test_translate.py which is inside models folder.

1. Added warning message like this :

from odoo.exceptions import UserError
from odoo import api, fields, models, _

your_proble_exist = True
test_val = "SO12345"
warning_message =_("Hello Anil, My problem Solved, Thank you.")
if your_proble_exist:
raise UserError(_('%s %s')% (warning_message,test_val))

2.. Added Entry for the message in .po file like this :

#. module: anil_test_translate
#: code:addons/anil_test_translate/models/test_translate.py:6
#, python-format
msgid "Hello Anil, My problem Solved, Thank you."
msgstr "Hola Anil, mi problema resuelto, gracias."

I hope this will solve you translation problem if you are facing an error on warning message : 


Cheers!

Anil

Avatar
Discard
Author Best Answer

I did that but it has not translated yet. Why?

Avatar
Discard