سؤال

By default pybabel is extacting ${_("mystr")} strings just fine from my mako templates, but when I try to use ${pgettext("myctx", "mystr")} for contextual translations, it doesn't seem to find and extract them.

My babel config is pretty basic:

[mako: templates/**.mako]
encoding = utf-8

Does anyone know how to get pybabel to extract pgettext translations from mako templates?

لا يوجد حل صحيح

نصائح أخرى

With Flask I implemented it importing pgettext for Mako:

kw['imports'] = ['from flask.ext.babel import gettext as _, pgettext']

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top