Thanks for this. I was not aware of the mlang filters; I will certainly take a look at them, as they look much easier to create content with than the span tags.
However, the point behind the original question was that I'd really rather avoid hard-coding the keys, as if any of these options change in future, I will need to dive into the code then to change the keys accordingly. At the moment these options are being pulled from a user profile dropdown field, which is simple enough to configure, and I don't want to introduce a dependency on code changes if I can help it. Iñaki's response works very well for my needs here.