How i can check variable for non-empty in selector?

How i can check random $variable for non-empty/existing?
What about if variable will not passed from application?

For example, random .ftl file:

that_string = 
{    $username ->
          [what i need to pass there?] Hello! ### - if $username is empty
        *[other] Hello, { $username }!
}.

I need to check $username for existance inside FTL syntax.
How it’s possible?

Fluent selection is not meant to replace code logic.
You should check if the user name is present and decide on what l10n message to use to localize it.
You should have two messages hello-not-logged-in and hello-logged-in and the latter should take a variable.

See https://github.com/projectfluent/fluent/wiki/Good-Practices-for-Developers for more details.

1 Like