Refs #23196 -- Don't translate empty string as gettext metadata

Added `if` before actual text translation.
Returns empty message of corresponding type instead of gettext metadata.

Added test to check if empty value stays empty value of corresponding type

Simplify code

more clear type checking