what's the _() function means in lambda s: _('Blocked')
It's import in: from odoo import api, fields, models, tools, SUPERUSER_ID, _
Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:
what's the _() function means in lambda s: _('Blocked')
It's import in: from odoo import api, fields, models, tools, SUPERUSER_ID, _
Thank you!
I find it define in odoo/tools/translate.py as:
_ = GettextAlias()
But GettextAlias is define as a class, not a string type, How can it translate a class to string?
Best Regards! |
Odoo cannot automatically export translatable terms so they must be marked explicitly for export. This is done by wrapping a literal string in a function call. so for python, the wrapping function is odoo._().
NB:
Only literal strings can be marked for exports, not expressions or
variables. For situations where strings are formatted, this means the
format string must be marked, not the formatted string