Skip to content

Conversation

@thet
Copy link
Member

@thet thet commented Oct 3, 2025

Reverse the sentinel logic and include the debug message only if sentinel=true. This way it must be explicitly set and avoids breaking the html-comment-wrapped sentinel message within html-comments and html-attributes.

Ref: https://github.com/syslabcom/oira.prototype/issues/559

The problem is that when we do not explicitly set sentinel=false a debug message in form of an HTML comment is rendered along with the translated string. But when a HTML comment is rendered as part of a HTML attribute value, this is broken HTML. The same goes for HTML comments within HTML comments. We have both cases in the oira.prototype (i18n translations are used within attributes and sometimes i18n translations are part of a commented-out HTML‌ block.

Currently there are many places where the i18n output is included like so:

_includes/patterns/form-panel.html
57:                    href="{{ include.help_url }}">{%- include patterns/i18n sentinel=false id="label_help" -%}</a>

This is the way to exclude the sentinel.

But we still have these cases:

_layouts/training.html
61:		        	title="{% include patterns/i18n id='patterns.label_table_of_contents' %}">
feedback/new-user.html
13:        {% include patterns/i18n id="message_invite_user" %}
28:                href="mailto:?subject={% include patterns/i18n id='label_email_invite_user_subject' %}&body={% include patterns/i18n id='message_email_invite_user_body' %}
_layouts/panel-edit-organisation.html
57:            title="{% include patterns/i18n id='label_delete_organisation' %}"
64:                title="{% include patterns/i18n id='label_delete_organisation' %}"

And so on.

This would produce code like:

<a href="..." title="<!-- i18n: message-id -->
translation string">text</a>

Instad of catching all cases where the sentinel needs to be excluded it's better to exclude it by default and only include it when needed.

I would strongly advise to consider this PR, unless there is an even stronger reason to not do so.

…inel=true. This way it must be explicitly set and avoids breaking the html-comment-wrapped sentinel message within html-comments and html-attributes.

Ref: syslabcom/oira.prototype#559
@thet thet force-pushed the reverse-sentinel branch from 376b122 to 5231b80 Compare October 22, 2025 14:18
@thet thet changed the title Reverse the sentinel logic and include the debug message only if sent… Reverse the sentinel inclusion logic Oct 22, 2025
@thet thet reopened this Oct 23, 2025
@pilz
Copy link
Member

pilz commented Oct 23, 2025

Daniel has fixed the sentinels where they broke, so the problem should be gone.

@pilz pilz marked this pull request as draft October 23, 2025 14:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants