You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have a custom tr tag that returns internationalized strings from a dictionary, and I'd like to apply a Selmer filter to its output. Is that possible?
As a simple example: say {% tr core/greeting %} parses to Hello or Hola depending on a user's current language preference, and I'd like to then apply |upper to the output of that tag.
The text was updated successfully, but these errors were encountered:
@unitof a tag is expected to output a rendered template, while a filter is an operation on a variable.
what you could do is create a filter tag, which you could wrap a tag in, which would apply an existing filter to the contents in a tag. this doesn't make sense for a lot of filters.
{% tr core/greeting filters=uppercase|replace:whatever %} something like that. and how far you go with parsing would be up to you.
i think a param is probably better than a wrapper tag. i haven't run into needing to apply filters to tags, and i do a lot of weird stuff with templating. i think i would likely approach your tr tag solution as a filter itself, but that's a person preference.
I have a custom
tr
tag that returns internationalized strings from a dictionary, and I'd like to apply a Selmer filter to its output. Is that possible?As a simple example: say
{% tr core/greeting %}
parses toHello
orHola
depending on a user's current language preference, and I'd like to then apply|upper
to the output of that tag.The text was updated successfully, but these errors were encountered: