콘텐츠로 건너뛰기
메뉴
커뮤니티에 참여하려면 회원 가입을 하시기 바랍니다.
신고된 질문입니다

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

관련 게시물 답글 화면 활동
0
3월 15
2742
0
5월 21
4253
Website translation 해결 완료
2
3월 15
5452
1
1월 25
13474
4
5월 23
9070