Add msg_gettext and msg_ngettext to Report context
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
* Add msg_gettext and msg_ngettext to Report context
|
||||
* Support plural translation of messages
|
||||
* Support plural translations in report
|
||||
* Add plural source to translations
|
||||
|
||||
@@ -73,6 +73,8 @@ Class methods are:
|
||||
- :meth:`~Report.barcode`
|
||||
- :meth:`~Report.qrcode`
|
||||
- ``set_lang``
|
||||
- :meth:`~trytond.i18n.gettext` as ``msg_gettext``
|
||||
- :meth:`~trytond.i18n.ngettext` as ``msg_ngettext``
|
||||
|
||||
.. classmethod:: Report.render(report, report_context)
|
||||
|
||||
|
||||
@@ -34,7 +34,7 @@ from genshi.filters import Translator
|
||||
from genshi.template.text import TextTemplate
|
||||
|
||||
from trytond.config import config
|
||||
from trytond.i18n import gettext
|
||||
from trytond.i18n import gettext, ngettext
|
||||
from trytond.model.exceptions import AccessError
|
||||
from trytond.pool import Pool, PoolBase
|
||||
from trytond.rpc import RPC
|
||||
@@ -368,6 +368,8 @@ class Report(URLMixin, PoolBase):
|
||||
language = language.code
|
||||
Transaction().set_context(language=language)
|
||||
report_context['set_lang'] = set_lang
|
||||
report_context['msg_gettext'] = gettext
|
||||
report_context['msg_ngettext'] = ngettext
|
||||
|
||||
return report_context
|
||||
|
||||
|
||||
Reference in New Issue
Block a user