Skip to Content
เมนู
คุณต้องลงทะเบียนเพื่อโต้ตอบกับคอมมูนิตี้
คำถามนี้ถูกตั้งค่าสถานะ
1 ตอบกลับ
7865 มุมมอง

I already know I can localize python string using the following code:

localized_string = _('Resource key')

But when I go to Settings => Translations => Import/Export => Export translation , the generated file doesn't include any of the string localized using the aforementioned way.


Why is that, and how can I fix this?

อวตาร
ละทิ้ง
คำตอบที่ดีที่สุด

Those strings need to be added to the .po file using python-format like:

#. module: stock
#: code:addons/stock/stock.py:1662
#, python-format
msgid " (%s reserved)"
msgstr " (%s reservado)"

อวตาร
ละทิ้ง
ผู้เขียน

Thanks for your help. But my question was why aren't those line automatically generated when I export the module translation file. I tested it with Odoo defaults module and it works flawlessly, but theses lines aren't generated for my custom module.

When Odoo export your translation it export what it reside in the db and that kind of terms wouldn't be on the database if you don't define like the example before in a .po

ผู้เขียน

Then how come Odoo can generate resources for the text in the XML views?

viewing at the code of export translation there are functions to extract terms to translate from .py files

Related Posts ตอบกลับ มุมมอง กิจกรรม
0
มี.ค. 15
2658
0
พ.ค. 21
4148
Website translation แก้ไขแล้ว
2
มี.ค. 15
5362
1
ม.ค. 25
13290
4
พ.ค. 23
8956