TranslatableString.toString

Forces evaluation as translated string.

In a limited set of circumstances, a TranslatableString may forcefully need to be interpreted as a string. One of these cases is a *named* enum:

enum E {member = tr!"translation"}
writeln(E.member);          // "member"
writeln(E.member.toString); // "translation"

Contrary, anonimous enums and manifest constants do not require this treatment:

enum {member = tr!"translation"}
writeln(member); // "translation"
  1. string toString()
    struct TranslatableString
    const
    string
    toString
    ()
  2. void toString(void delegate(scope const(char)[]) @(safe) sink)

Meta