8000 UX: Display interpolation keys in site text and email template editors by ZogStriP · Pull Request #37254 · discourse/discourse · GitHub
[go: up one dir, main page]

Skip to content

Conversation

@ZogStriP
Copy link
Member

When editing site texts or email templates, admins can now see which interpolation keys are available for that particular translation. Keys that are already used in the content are highlighted in bold, making it easy to see at a glance which placeholders are in use and which ones are still available.

This also improves the server-side validation for interpolation keys. Previously, malformed keys like %{user.username} would silently pass validation because the regex only matched word characters. Now we use a more permissive pattern that catches any %{...} attempt and properly reports invalid keys, helping admins catch typos before saving.

Ref - t/172375

When editing site texts or email templates, admins can now see which
interpolation keys are available for that particular translation. Keys
that are already used in the content are highlighted in bold, making it
easy to see at a glance which placeholders are in use and which ones
are still available.

This also improves the server-side validation for interpolation keys.
Previously, malformed keys like `%{user.username}` would silently pass
validation because the regex only matched word characters. Now we use
a more permissive pattern that catches any `%{...}` attempt and properly
reports invalid keys, helping admins catch typos before saving.

Ref - t/172375
Comment on lines +389 to +393
&:not(:last-of-type)::after {
content: " - ";
font-weight: normal;
color: var(--primary-low-mid);
}
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't like this hack one bit ☹️

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

0