I'm stuck with xgettext
missing tag attributes in HTML templates, e.g.:
xgettext --keyword=_ --language=Python -o - - <<EOF
<!DOCTYPE html>
<html>
<head>
% msg = _('A translatable string')
<title>{{ _('Page title') }}</title>
</head>
<body>
<a href="#" title="{{ _('title') }}">_('Link text')</a>
</body>
</html>
EOF
returns
# SOME DESCRIPTIVE TITLE.
# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
# This file is distributed under the same license as the PACKAGE package.
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
#
#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2021-10-20 11:52+0200\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
"Language: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=CHARSET\n"
"Content-Transfer-Encoding: 8bit\n"
#: standard input:4
msgid "A translatable string"
msgstr ""
#: standard input:5
msgid "Page title"
msgstr ""
#: standard input:8
msgid "Link text"
msgstr ""
where a
's title
attribute is skipped.
FWIW, the template language is Python bottle
's SimpleTemplate Engine which is incompatible with standard pybabel
.
(To tell the truth you'll get the same result -- i.e. tag attributes ignored -- using pybabel
's javascript extractor, which I would rather use with the following babel.cfg
)
[python: **/**.py]
[javascript: views/**.html]
Other tentative I did: use Jinja2 extractors which are incompatible with SimpleTemplate Engine's template inheritance syntax {{!base}}