简体   繁体   English

如何将翻译添加到 odoo 15 中的自定义模板

[英]How do I add translation to custom templates in odoo 15

In odoo 15 I have created a custom layout template for an invoice report (PDF).在 odoo 15 中,我为发票报告 (PDF) 创建了一个自定义布局模板。 This template contains some texts in German language.该模板包含一些德语文本。 Where do I have to specify any translation of these texts so they are considered if the invoice is printed in eg English?我必须在哪里指定这些文本的任何翻译,以便在发票以英语打印时考虑它们?

Activate debug mode.激活调试模式。

  1. You can find it in settings > translations > Transleted terms, and you search for your germans terms for translate them one by one.您可以在设置 > 翻译 > 已翻译的术语中找到它,然后搜索您的德语术语以将它们一一翻译。

  2. You can set your template manually, settings > Technical > Email templates and now you can edit the template.您可以手动设置模板,设置 > 技术 > Email 模板,现在您可以编辑模板。 But this is a non-dynamic solution.但这是一个非动态的解决方案。

More dynamic way:更动态的方式:

  1. Use.po,.pot files in your custom modules.在您的自定义模块中使用 .po、.pot 文件。 if you have computed strings in your template use the function "_" before.如果您在模板中计算过字符串,请使用 function 之前的“_”。 Ex:前任:
my_str = _("Hello, how are you")

afterwards, edit the '.po' file之后,编辑“.po”文件

Look at the documentation here: https://www.odoo.com/documentation/16.0/developer/howtos/translations.html在此处查看文档: https://www.odoo.com/documentation/16.0/developer/howtos/translations.html

Regards,问候,

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM