Behind the scenes
Class TransactionTxt drives this feature end to end. If you see the method txt(), the last line explains it all.
In one of the customizations, I was required to populate description value on invoice transactions. I used a display method with below logic, the use of TransactionTxt class is self evident.