Apply formatter to static string

Wappler Version : 5.5.3

Expected behavior

What do you think should happen?

You should be able to apply a formatter to a static string.
This should be possible from the UI:

{{'ball'.t()}}

Actual behavior

What actually happens?

You can’t.

Wappler 04-04-2023 10.29.34 000436

Strings should be treated as entities when parsing. I know in AC context it sounds counterintuitive to apply a formatter to a static string as basically it’s in its final format and not due to changes. Still you can apply a custom formatter to a string that will entirely change the output based on certain conditions.
In my case, the language.

Does it make any difference if you apply it like:

{{('ball').t()}}

It will treat it as an entity subject to formatting.
I could write a note saying it has to be that way but it’s not very friendly.

Would it be very complicated to add to the parser static strings? Or would it cause undesired effects in other parts of the UI expression builder?

Also, I’ve just checked trying to add it from “design view” and it won’t work and the parser will change the expression completely. I’ll attach a video.

No, it doesn’t have to be this way, just asking if it makes any difference :slight_smile:

This is something for @George to check.

1 Like

1 Like