@kshegunov
Well the use case was to match the interface currently being used to provide variables to the tr() (translate functions). We have code that looks like this:
tr("Log Message","Status: %1").arg(2)
Well the problem with this is the string is in a server and the client needs to translate the message. So I wanted to wrap the message in a similar way and use the same arg() interface we currently use.
JMsg(QT_TRANSLATE_NOOP("Log Message","Hello: %1 %2 %3")).arg(1).arg("full").arg("world");
The JMsg overloads an operator:
operator QString(){return toString();}
This allows the call to be very similar to the original tr() call and return a string to the function it is created in. JMsg is intended to be a temporary variable. The string it produces is a JSON string that embeds the message with parameters and the args in a list. This is decoded by the client and translated using a function designed to interpret the JSON code.
So effectively I am modeling it after how the translate parameter system works, for the API anyway. Not the underlying code.
I don't program javascript or java much. Mainly C++ and Python.