What do macros decode to?

AI-generated summary

The discussion explores how macros like %{new_user_tips} in Discourse templates are resolved. ganncamp initially struggles to find where these macros are set. maiki explains that %{new_user_tips} corresponds to the system_messages.usage_tips.text_body_template key, found in Transifex, and notes the lack of clarity in the editor. supermathie clarifies that Transifex is for translations and isn’t relevant for understanding the macro’s source, while also pointing out that the macro values are defined in the code, with Arkshine identifying the relevant section in system_message.rb. ganncamp appreciates the explanation and notes that the defaults method implies these values can be customized.

I’m looking at the new user onboarding flow, and that has led me to the system_messages.welcome_user.text_body_template, which uses %{new_user_tips}, among other macros.

I’m struggling to find where these value are set.

It is not apparent to me, either! Fortunately someone referred to that exact macro before:

As for where it is used, /admin/customize/site_texts?locale=en&q=%25{new_user_tips} shows a few templates:

I’ve never seen another macro that pull into the content from another content template in Discourse. :slight_smile:

I… still don’t understand

What / where is ‘Transifex’?

And also, without asking here, how would I know that %{new_user_tips} == system_messages.usage_tips.text_body_template

Transifex is our system for people contributing translations for localisation. You don’t need to worry about that and can pretend it doesn’t exist.

But this is a good question - most of the below are (I think) self-evident except for new_user_tips. In any case it might be a good idea to have an ⓘ explanation nearby.

Available interpolation keys: site_name, new_user_tips, base_url, username, name, name_or_username

You’d have to go digging into the code to find system_messages.usage_tips.text_body_template.

This is something that could definitely be improved so it’s apparent in the editor.

I think the values are set here:

But I agree that it would be welcome to see a note about it somewhere.

Thanks @Arkshine! That’s helpful!

And… That block is named defaults, implying that they can be changed to point to other values…?