Ref T5267. Speculative, but here's the first step in maybe building stronger first-party tools. The next diff will demo this better.
Basically:
- When we're in translation mode, return a string-like object instead of a real string.
- Contexts that use it as a string usually just work, or we may need to add a few (string) casts.
- Contexts that use it as HTML get a tag instead. This is translatable in the UI.
- We keep track if we rendered it into a string or not so we can build a menu of "other strings on this page" for things like title, options in dropdowns, etc.