Skip to main content

templatize

Turn a Django template into something that is understood by xgettext. It does so by translating the Django translation tags into standard gettext function invocations.

def templatize(
src: string,
origin: string = null
) - > string

Turn a Django template into something that is understood by xgettext. It does so by translating the Django translation tags into standard gettext function invocations.

Parameters

NameTypeDescription
srcstringThe raw Django template content to be processed for translation tags.
originstring = nullThe optional file path or identifier of the source template, used to provide context in error messages and warnings.

Returns

TypeDescription
stringA string containing Python-compatible gettext function calls and comments that can be parsed by xgettext to extract translatable messages.