thunderbird / thunderbird-website

Build code for the websites on thunderbird.net and start.thunderbird.net
https://www.thunderbird.net
133 stars 72 forks source link

gettext compile errors #536

Open Sancus opened 7 months ago

Sancus commented 7 months ago

Running l10n_tools/compile.sh produces many "fatal errors" with the below format:

messages.po:249: 'msgid' and 'msgstr' entries do not both begin with '\n'
messages.po:284: 'msgid' and 'msgstr' entries do not both begin with '\n'
messages.po:321: 'msgid' and 'msgstr' entries do not both begin with '\n'
messages.po:352: 'msgid' and 'msgstr' entries do not both begin with '\n'
messages.po:362: 'msgid' and 'msgstr' entries do not both begin with '\n'
messages.po:381: 'msgid' and 'msgstr' entries do not both begin with '\n'

It's not clear if these are really fatal or not They don't seem to be really fatal, but we should investigate. I suspect something like localizers removing \n's when they shouldn't, or Pontoon messing up the formatting. Perhaps we can remove \n's from the beginning of strings since it's unlikely they do anything in HTML content.

MelissaAutumn commented 7 months ago

From modifying problem line in a locale.po file locally, and compiling again I can confirm that this isn't fatal. What's probably happening is jinja2 isn't stripping newlines when using block tags. Shouldn't be too hard to fix by either removing the new line like:

{% trans %}
Thunderbird is great!

And this is sample text!!
{% endtracks %}

to

{% trans %}Thunderbird is great!

And this is sample text!!
{% endtrans %}

or there may be a setting in jinja that auto strips this out.