In TW 7.1 , I can enable "Show Error Notification" for a service in mashup.
If it is checked .... I can give a custom error message.
Can this message be localized.
How are you showing the error notification? Which widget/service has that option?
If you go to configure Service as shown below. We are using Show Error Notification. But there doesn't seem to be any way to show localized message. I tried using token like this [[LocalizationToken]] but this too doesn't work.
Vivek, I don't think that can be localized at the moment, as it is not a property setting per se. For example, if you take a look at a widget like the Button, the labels or tooltips are usually localizable. This would be an improvement/ enhancement to the existing feature.
There are a few ways to do this actually.
Probably the easiest way is to use GetToken against the standard localization within Thingworx.
So you evaluate the error, assign a token, translate that.
Now you can use GetToken and that will return the localized language (since it uses CurrentUser as the context)
Then return that value either in a Throw or as a Result to display in the runtime mashup
Thanks Aanjan for taking time to reply to this thread. I have created a enhancement request with support for this.
Thanks Pai for brainstorming one of way to do it. If i understand your way correctly it wont work for me since I cant throw or return a result to display from the service since User doesn't have permissions itself ob the Thing to execute the service. And the exception as part of [server-message] comes from Thingworx core classes which I cant customize to have my own customized message which can be localized.
I don't see why you can't. The user being able to see [server-message] means it executed the service that generated the error.
If that is a system default service, then just create a wrapper service around it so you can do the throw.
Let me elaborate the usecase. We have start page. This page is rendered dynamically by collecting apps with help of service on a Thing. And apps are role based i.e. only if a user belongs to particular role and that role has been assigned permissions by the Administrator for a particular app only then does that role see any apps. For a User who has been not assigned any permissions for thing which collects apps, the service code will never be hit. And the server message that is being displayed in Status bar is like "Not Authorized for Service Invoke on this thing". And what we want to do is instead of that message, we want to show customized user friendly message which is localizable.