I have a number of applications written in different languages (Java, JavaScript, PHP, etc.). Their view/presentation layers display things in various formats: HTML, plain text, etc.
I want to display some textual/numeric data in roughly the same way in each application. Of course, the result would be slightly different depending on the output format (e.g. if you're outputting HTML, you'd have to run some HTML-encoding functions, and if you're outputting plain text, you'd have to ignore things like links.)
So I was thinking of storing the formatting information in some sort of abstract configuration language. Then each application could parse the formatting info, convert it to code in its own language, and run the code to generate the actual display text.
For example:
Welcome <username>. Your balance is <balance format:usDollars>. <if returning>You last logged in on <lastLoginDate format:m/d/Y></if>
My question is: do I need to invent such a syntax from scratch? Or is there an existing templating/formatting language that's made to be cross-platform?